Skip to content

Keep the paragraphs of a blockquote on separate lines in HTMLToMarkdown - #1408

Merged
davidmezzetti merged 1 commit into
neuml:masterfrom
RavSinghChandan:blockquote-paragraphs
Oct 15, 2026
Merged

davidmezzetti merged 1 commit into
neuml:masterfrom
RavSinghChandan:blockquote-paragraphs

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

HTMLToMarkdown.block() used node.text, which joins child paragraphs with nothing between them. With compact HTML, as written by most generators and minifiers, <blockquote><p>First</p><p>Second</p></blockquote> became > FirstSecond, merging the last word of one paragraph into the first word of the next. Pretty-printed HTML only worked because of the newlines between the tags.

Each paragraph (or div) inside a blockquote now starts on its own line, so compact and pretty-printed HTML give the same > First\n> Second. Text before or after a paragraph is kept on its own line too, and blockquotes without paragraphs are unchanged. Added cases to testHTML.

@davidmezzetti

Copy link
Copy Markdown
Member

Is this same fix as #1409?

@RavSinghChandan

Copy link
Copy Markdown
Contributor Author

No, they fix different things. #1409 handles paragraphs wrapped in inline elements like in article/main mode (#1407). This one is about blockquotes: block() used node.text, so

Test1

Test2

became "> Test1Test2". I checked #1409's branch and it still gives "> Test1Test2" there, while this PR gives "> Test1\n> Test2". The two don't overlap and merge cleanly together.

@davidmezzetti davidmezzetti added the bug Something isn't working label Oct 15, 2026
@davidmezzetti davidmezzetti added this to the v9.15.0 milestone Oct 15, 2026
@davidmezzetti

Copy link
Copy Markdown
Member

LGTM - Thank you!

@davidmezzetti
davidmezzetti merged commit 6e3b507 into neuml:master Oct 15, 2026
5 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants