Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5c895bf

Browse files
Fix newline on edit messages with quotes (#7227)
1 parent 8905c5d commit 5c895bf

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Markdown.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ function isAllowedHtmlTag(node: commonmark.Node): boolean {
5656
function isMultiLine(node: commonmark.Node): boolean {
5757
let par = node;
5858
while (par.parent) {
59-
// commonmark Parser separate quotes with blank quoted lines between them with
60-
// paragraphs, so we need to consider it when the markdown is only a multiline quote.
61-
if (par.type === 'block_quote') {
62-
break;
63-
}
64-
6559
par = par.parent;
6660
}
6761
return par.firstChild != par.lastChild;
@@ -135,7 +129,10 @@ export default class Markdown {
135129
// 'inline', rather than unnecessarily wrapped in its own
136130
// p tag. If, however, we have multiple nodes, each gets
137131
// its own p tag to keep them as separate paragraphs.
138-
if (isMultiLine(node)) {
132+
// However, if it's a blockquote, adds a p tag anyway
133+
// in order to avoid deviation to commonmark and unexpected
134+
// results when parsing the formatted HTML.
135+
if (node.parent.type === 'block_quote'|| isMultiLine(node)) {
139136
realParagraph.call(this, node, entering);
140137
}
141138
};

0 commit comments

Comments
 (0)