Skip to content

Commit bd19fcb

Browse files
authored
Wrap code text in template readme files (coder#2562)
1 parent 92bcace commit bd19fcb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

site/src/pages/TemplatePage/TemplatePageView.stories.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@ Example.args = {
1919
export const SmallViewport = Template.bind({})
2020
SmallViewport.args = {
2121
template: Mocks.MockTemplate,
22-
activeTemplateVersion: Mocks.MockTemplateVersion,
22+
activeTemplateVersion: {
23+
...Mocks.MockTemplateVersion,
24+
readme: `---
25+
name:Template test
26+
---
27+
## Instructions
28+
You can add instructions here
29+
30+
[Some link info](https://coder.com)
31+
\`\`\`
32+
# This is a really long sentence to test that the code block wraps into a new line properly.
33+
\`\`\``,
34+
},
2335
templateResources: [Mocks.MockWorkspaceResource, Mocks.MockWorkspaceResource2],
2436
}
2537
SmallViewport.parameters = {

site/src/pages/TemplatePage/TemplatePageView.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ export const useStyles = makeStyles((theme) => {
8383
markdownWrapper: {
8484
background: theme.palette.background.paper,
8585
padding: theme.spacing(3.5),
86+
87+
// Adds text wrapping to <pre> tag added by ReactMarkdown
88+
"& pre": {
89+
whiteSpace: "pre-wrap",
90+
wordWrap: "break-word",
91+
},
8692
},
8793
resourcesTableContents: {
8894
margin: 0,

0 commit comments

Comments
 (0)