Skip to content

Commit

Permalink
Preserve trailing whitespace for Markdown, HTML & MJML (RedwoodJS pro…
Browse files Browse the repository at this point in the history
…ject + create-redwood-app template) (#5869)

Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
  • Loading branch information
Philzen and Tobbe committed Dec 21, 2023
1 parent 512ef36 commit 880edcb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
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"
}
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

0 comments on commit 880edcb

Please sign in to comment.