Skip to content

Commit

Permalink
fix: don't render terminal linebreaks
Browse files Browse the repository at this point in the history
Our markdown syntax does not support teminal line-breaks, either
in blocks like a paragraph or just in text.

We had correctly been suppressing rendering the slash-escaped line
break when it appeared in a paragraph, but not in text
  • Loading branch information
bachbui committed Jun 27, 2024
1 parent 01a19fb commit b352160
Show file tree
Hide file tree
Showing 3 changed files with 1,174 additions and 49 deletions.
4 changes: 4 additions & 0 deletions packages/@atjson/renderer-commonmark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ export default class CommonmarkRenderer extends Renderer {
return "";
}

if (context.parent == null && context.next == null) {
return "";
}

// MD code and html blocks cannot contain line breaks
// https://spec.commonmark.org/0.29/#example-637
if (context.parent?.type === "code" || context.parent?.type === "html") {
Expand Down
Loading

0 comments on commit b352160

Please sign in to comment.