[Feature]: Option to render a single newline as a CommonMark soft break (configurable breaks)
Problem Statement
Most authored Markdown, including product documentation, is hard-wrapped at ~80 columns: one paragraph is written across several source lines separated by single newlines. Per the CommonMark/GFM specification a single newline inside a paragraph is a soft break (a space), so those wrapped lines flow back into one continuous paragraph. VS Code's built-in Markdown preview renders them exactly that way.
Markdown for Humans renders the same document with a visible line break at every wrap point, so a normal paragraph looks broken into many short lines. This is not a rendering accident: the editor hardcodes the marked breaks: true option, which turns every single newline into a <br>.
Source pointer: src/webview/editor.ts in the Markdown.configure({ markedOptions: { ... } }) call sets breaks: true. Interestingly, the change-detection layer in src/editor/markdownAstEquivalence.ts uses breaks: false and its comment explains that a single newline should be a soft break "which matches how readers see the document." So the rendering path and the equivalence path currently disagree.
Proposed Solution
Do not simply flip the default: some users deliberately want single-newline-as-<br> (note-taking / GitHub-comment style). Instead, make it configurable.
Add a boolean setting markdownForHumans.render.singleLineBreaks:
true (default): current behavior, a single newline renders as a hard break (<br>). No existing user is affected.
false: follow CommonMark/GFM, a single newline is a soft break (a space), so hard-wrapped paragraphs flow into one line, matching VS Code's built-in preview.
Because breaks is a marked parse-time option, the setting is read when a document is parsed, so a change takes effect when the document is (re)opened, consistent with how markdownForHumans.blankLines.mode already behaves.
Alternatives Considered
- Flipping the hardcoded default to
false: rejected, it would surprise users who rely on the current behavior.
- Auto-detecting
.md vs .mdx or file content: more magic, less predictable than an explicit setting.
Examples
Source (hard-wrapped paragraph):
This section contains example configurations for Ververica Platform. The configuration can be passed
to Ververica Platform during the installation via the values.yaml file.
- With
breaks: true (today): two lines with a <br> between them.
- With
breaks: false (proposed opt-in): one flowing paragraph, same as VS Code's preview.
Priority
Medium
Feature Category
Editing experience (WYSIWYG, formatting, etc.)
Additional Context
I have a PR ready that implements exactly this (setting wired through the provider and webview, default unchanged, with tests). Happy to open it against this issue.
[Feature]: Option to render a single newline as a CommonMark soft break (configurable
breaks)Problem Statement
Most authored Markdown, including product documentation, is hard-wrapped at ~80 columns: one paragraph is written across several source lines separated by single newlines. Per the CommonMark/GFM specification a single newline inside a paragraph is a soft break (a space), so those wrapped lines flow back into one continuous paragraph. VS Code's built-in Markdown preview renders them exactly that way.
Markdown for Humans renders the same document with a visible line break at every wrap point, so a normal paragraph looks broken into many short lines. This is not a rendering accident: the editor hardcodes the marked
breaks: trueoption, which turns every single newline into a<br>.Source pointer:
src/webview/editor.tsin theMarkdown.configure({ markedOptions: { ... } })call setsbreaks: true. Interestingly, the change-detection layer insrc/editor/markdownAstEquivalence.tsusesbreaks: falseand its comment explains that a single newline should be a soft break "which matches how readers see the document." So the rendering path and the equivalence path currently disagree.Proposed Solution
Do not simply flip the default: some users deliberately want single-newline-as-
<br>(note-taking / GitHub-comment style). Instead, make it configurable.Add a boolean setting
markdownForHumans.render.singleLineBreaks:true(default): current behavior, a single newline renders as a hard break (<br>). No existing user is affected.false: follow CommonMark/GFM, a single newline is a soft break (a space), so hard-wrapped paragraphs flow into one line, matching VS Code's built-in preview.Because
breaksis a marked parse-time option, the setting is read when a document is parsed, so a change takes effect when the document is (re)opened, consistent with howmarkdownForHumans.blankLines.modealready behaves.Alternatives Considered
false: rejected, it would surprise users who rely on the current behavior..mdvs.mdxor file content: more magic, less predictable than an explicit setting.Examples
Source (hard-wrapped paragraph):
breaks: true(today): two lines with a<br>between them.breaks: false(proposed opt-in): one flowing paragraph, same as VS Code's preview.Priority
Medium
Feature Category
Editing experience (WYSIWYG, formatting, etc.)
Additional Context
I have a PR ready that implements exactly this (setting wired through the provider and webview, default unchanged, with tests). Happy to open it against this issue.