Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix hard line breaks displayed with additional new line between
To preserve softbreaks within md files we preserve all whitespaces,
so we must not introduce additional new lines after `<br>` elements.

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and juliusknorr committed Nov 11, 2022
commit df019d9d651024b6c655ba36abc03e9c29ef159a
3 changes: 3 additions & 0 deletions src/markdownit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ const markdownit = MarkdownIt('commonmark', { html: false, breaks: false })
.use(keepSyntax)
.use(markdownitMentions)

// Issue #3370: To preserve softbreaks within md files we preserve all whitespaces, so we must not introduce additional new lines after a <br> element
markdownit.renderer.rules.hardbreak = (tokens, idx, options) => (options.xhtmlOut ? '<br />' : '<br>')

export default markdownit