Conversation
|
🚀 Preview deployment available at: https://31657d5e.rdoc-6cd.pages.dev (commit: 2d74d02) |
1959fd1 to
d658309
Compare
6f54b65 to
c168d42
Compare
3d620eb to
0706cd1
Compare
0706cd1 to
652ed49
Compare
There was a problem hiding this comment.
Pull request overview
Fixes blockquote parsing so that (1) unquoted blank lines terminate a blockquote instead of being absorbed, and (2) “lazy continuation” does not incorrectly consume certain block-level constructs that should break out of a blockquote.
Changes:
- Update
BlockQuoteRawgrammar to require>-prefixed blank lines for blockquote continuation. - Add negative lookaheads to prevent lazy continuation from consuming headings/list markers/code fences.
- Add regression tests for separate blockquotes and lazy-continuation breakouts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
test/rdoc/rdoc_markdown_test.rb |
Adds tests covering separated blockquotes and ensuring list/heading/fence starters break out of lazy continuation. |
lib/rdoc/markdown.rb |
Updates generated parser implementation of BlockQuoteRaw to match the revised grammar. |
lib/rdoc/markdown.kpeg |
Updates the PEG grammar for BlockQuoteRaw to correctly terminate on unquoted blank lines and block certain lazy continuations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| assert_equal expected, doc | ||
| end | ||
|
|
There was a problem hiding this comment.
There are tests toggling @parser.github = false for fenced code blocks, but the new blockquote/code-fence interaction isn’t covered in that mode. Add a regression test that sets @parser.github = false and verifies that a ``` line does not force a blockquote to terminate (since fences aren’t block-level without the GitHub extension).
| def test_parse_block_quote_no_lazy_continuation_for_code_fence_non_github | |
| @parser.github = false | |
| doc = parse <<~BLOCK_QUOTE | |
| > foo | |
| ``` | |
| code | |
| ``` | |
| BLOCK_QUOTE | |
| expected = | |
| doc( | |
| block( | |
| para("foo\n```\ncode\n```"))) | |
| assert_equal expected, doc | |
| end |
lib/rdoc/markdown.kpeg
Outdated
| (( ">" " "? Line:l { a << l } ) | ||
| ( !">" !@BlankLine Line:c { a << c } )* | ||
| ( @BlankLine:n { a << n } )* | ||
| ( !">" !@BlankLine !AtxStart !Bullet !Enumerator !Ticks3 Line:c { a << c } )* |
There was a problem hiding this comment.
Does this work with the following cases?
> x
#no-space-headingx
#no-space-heading
> x
|header|
|--|
|content|x
|header|
|--|
|content|
There was a problem hiding this comment.
- Kinda yes. It's displayed that way but
#is stripped. It's a bug I'll address separately in Preserve#prefix for unresolved cross-references #1676 - The table is included on the same time as
xin the quote block. I tried to fix it but it's a much more complex fix so I think it deserves a separate PR.
There was a problem hiding this comment.
It makes sense.
We may need to add more !XXX eventually. (XXX will be came from
Lines 566 to 581 in 799e551
- Headings (`# foo`), bullet lists, ordered lists, and code fences now
break out of a blockquote instead of being lazily continued.
- Unquoted blank lines end the blockquote; only `>`-prefixed blank
lines continue it.
- Heading lookahead uses `!(AtxStart @Spacechar)` so `#no-space` text
(not a valid heading) is correctly kept inside the blockquote.
- Code fence lookahead is gated behind `&{ github? }` so it only
applies when the GitHub extension is enabled, matching `CodeFence`.
Ref: #1627
When `#name` doesn't resolve to a method, the cross-reference handler was stripping the `#` and returning just the name. Now the original text including `#` is restored when the lookup fails. This fixes rendering of text like `#no-space-heading` in Markdown paragraphs, where the `#` was silently dropped in the final HTML.
652ed49 to
2d74d02
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Two fixes to the
BlockQuoteRawrule in the PEG grammar:>continue the blockquote, so an unquoted blank line ends it.Ref: #1550 (comment)