Repository navigation
Draw Markdown block quotes with a bar and a background - #1133
Open
KnifeLemon wants to merge 1 commit into
Open
KnifeLemon wants to merge 1 commit into
KnifeLemon wants to merge 1 commit into
Conversation
Markdown parsed every quote correctly, with a BOM, front matter, CRLF or nesting too, but the reader only turned it into a left indent. In a PDF that is a slightly indented paragraph, which nobody reads as a quote. A quote's paragraphs now carry a left bar and a faint background, written as a paragraph border in HWPX, which rhwp draws, and as w:pBdr and w:shd in DOCX. The indent stays, so the Markdown writer still reads it back as a quote. Fixes #1098 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1098
Cause
Markdown → PDF is the HWPX writer followed by rhwp (
MarkdownReader, not themarkdownengine, which only does HTML and TXT). The quote wasn't lost in parsing: the issue's line (with its leading space), a quote at the very start, a BOM, front matter, CRLF and nested quotes all come out of Markdig asQuoteBlock.MarkdownReaderthen mapped a quote toHParaFormat(Left: 2000)and nothing else. On the page that is a paragraph indented by 7 mm, which is what the reporter's screenshot shows.Fix
HParaFormatgetsLeftBarandFill, andMarkdownReadersets them on a quote's paragraphs. Definition lists use the same indent and stay without a bar.hh:borderpointing at aborderFillwith only a left line), connected across paragraphs. rhwp draws it, and 한글 reads it as a normal paragraph border.w:pBdrandw:shd, inCT_PPr's order.MarkdownWriterstill turns it back into>. Writers that don't know the new fields (EPUB, FB2, text) are unchanged.How it looks in rhwp
Tests
In
MarkdownTests: the reader (six ways a quote can open a file, nesting, a definition list stays bar-free), the HWPX and DOCX output, and the PDF itself (rhwp, then pixels: background and a bar taller than a line).MarkdownTests,DocxWriterTestsandHwpxReaderTests: 46 passed, 1 skipped (LibreOffice isn't installed here). With the reader's old mapping restored, the 9 reader, HWPX and DOCX cases fail. The PDF test failed in that run too, but on an rhwp timeout rather than its assertion, so that one isn't proven red; a direct rhwp export of the same document shows no bar or background without the change.rhwp was very slow to start from the test host on this loaded machine (several
did not finish within 127 s, including the existingMarkdown_to_pdf_with_built_in_engines, with the process idle at 3 MB). Run directly it takes seconds, and the tests pass on a retry.🤖 Generated with Claude Code