Skip to content

Commit bd19fcb

Browse files
authored
Wrap code text in template readme files (#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

Lines changed: 13 additions & 1 deletion
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

Lines changed: 6 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy