Skip to content

Wrap code text in readme files on template page #2562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion site/src/pages/TemplatePage/TemplatePageView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ Example.args = {
export const SmallViewport = Template.bind({})
SmallViewport.args = {
template: Mocks.MockTemplate,
activeTemplateVersion: Mocks.MockTemplateVersion,
activeTemplateVersion: {
...Mocks.MockTemplateVersion,
readme: `---
name:Template test
---
## Instructions
You can add instructions here

[Some link info](https://coder.com)
\`\`\`
# This is a really long sentence to test that the code block wraps into a new line properly.
\`\`\``,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the way you tested this with a visual story instead of trying to locate the styles in a unit test.

templateResources: [Mocks.MockWorkspaceResource, Mocks.MockWorkspaceResource2],
}
SmallViewport.parameters = {
Expand Down
6 changes: 6 additions & 0 deletions site/src/pages/TemplatePage/TemplatePageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export const useStyles = makeStyles((theme) => {
markdownWrapper: {
background: theme.palette.background.paper,
padding: theme.spacing(3.5),

// Adds text wrapping to <pre> tag added by ReactMarkdown
"& pre": {
whiteSpace: "pre-wrap",
wordWrap: "break-word",
},
},
resourcesTableContents: {
margin: 0,
Expand Down