Skip to content
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

Preserve trailing whitespace for Markdown, HTML & MJML (RedwoodJS project + create-redwood-app template) #5869

Merged
merged 5 commits into from
Dec 18, 2023
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"**/__fixtures__": true,
".yarn-packages-cache": true
},
"[markdown][html][mjml]": {
"files.trimTrailingWhitespace": false
},
"typescript.tsdk": "node_modules/typescript/lib",
"peacock.color": "#b85833"
}
3 changes: 3 additions & 0 deletions __fixtures__/test-project-rsa/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[markdown][html][mjml]": {
"files.trimTrailingWhitespace": false
},
"[prisma]": {
"editor.formatOnSave": true
}
Expand Down
14 changes: 14 additions & 0 deletions docs/docs/project-configuration-dev-test-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,17 @@ Admittedly, the `.yarn` folder won't change that often, so this may not be
the best example. But we thought we'd share this technique with you
so that you'd know how to apply it to any folders that you know change very often,
and how to tell VSCode not to bother wasting any CPU cycles on them.

## Trailing whitespace

If you're using VS Code, or another editor that supports
[EditorConfig](https://editorconfig.org), trailing whitespace will be trimmed
in source files, but preserved in html, markdown and mjml files when saving.

This behavior is controlled by `.vscode/settings` or `.editorconfig` depending
on your editor.

In JavaScript and TypeScript files trailing whitespace has no significance,
but for html, markdown and mjml it does. That's why the behavior is different
for those files. If you don't like the default behavior Redwood has configured
for you, you're free to change the settings in those two files.
3 changes: 3 additions & 0 deletions packages/create-redwood-app/templates/js/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{md,html,mjml}]
trim_trailing_whitespace = false
Loading