Skip to content

Fix: block quotes not interrupting paragraphs#53

Merged
llimllib merged 1 commit intomainfrom
fix-blockquote-interrupt
Mar 14, 2026
Merged

Fix: block quotes not interrupting paragraphs#53
llimllib merged 1 commit intomainfrom
fix-blockquote-interrupt

Conversation

@llimllib
Copy link
Copy Markdown
Owner

Fixes #43. Per GFM spec §5.1, block quotes can interrupt paragraphs. Previously, handle_in_paragraph() did not check for blockquote markers, so lines like > bar were treated as literal text within the paragraph.

Changes

src/lib.rs

Added a parse_blockquote_marker() check in handle_in_paragraph(), after the code fence check. When a blockquote marker (>) is detected while in a paragraph:

  1. The current paragraph is emitted
  2. The parser transitions to InBlockquote state
  3. The blockquote content starts buffering

This follows the same pattern as the ATX heading interrupt (#52) and thematic break interrupt (#51).

tests/fixtures/blocks/blockquote_interrupts_paragraph.toml

Added a conformance test covering:

  • A single-line blockquote interrupting a paragraph (GFM spec Example 222)
  • A multi-line blockquote interrupting a paragraph
  • Verifies the paragraph is emitted when the blockquote line arrives, and the blockquote is emitted on the subsequent blank line

Session transcript

Claude Code session transcript

Fixes #43. Per GFM spec §5.1, block quotes can interrupt paragraphs.
Previously, handle_in_paragraph() did not check for blockquote markers,
so lines like '> bar' were treated as literal text within the paragraph.

Changes:
- Added parse_blockquote_marker() check in handle_in_paragraph()
- Added conformance test for blockquote interrupting paragraphs
@llimllib llimllib merged commit 19e6d61 into main Mar 14, 2026
3 checks passed
@llimllib llimllib deleted the fix-blockquote-interrupt branch March 14, 2026 02:32
llimllib added a commit that referenced this pull request Mar 14, 2026
Fixes #44. Per GFM spec §5.3, lists can interrupt paragraphs. Previously, `handle_in_paragraph()` did not check for list items, so lines like `- bar` were treated as literal text within the paragraph.

## Changes

### `src/lib.rs`
Added a `parse_list_item()` check in `handle_in_paragraph()`, after the blockquote marker check and before the table delimiter row check. When a list item is detected while in a paragraph:
1. The current paragraph is emitted
2. The parser transitions to `InList` state
3. The list starts buffering items

Per the GFM spec §5.3, ordered lists can only interrupt paragraphs if they start with `1`. Ordered lists starting with other numbers (like `14.`) are treated as continuation paragraph text.

This follows the same pattern as the blockquote interrupt (#53), ATX heading interrupt (#52), and thematic break interrupt (#51).

### `tests/fixtures/blocks/list_interrupts_paragraph.toml`
Added a conformance test covering:
- Unordered list interrupting a paragraph (GFM spec Example 283)
- Ordered list starting with 1 interrupting a paragraph
- Ordered list NOT starting with 1 cannot interrupt a paragraph (GFM spec Example 284)

## Session transcript
[Claude Code session transcript](https://github.com/llimllib/mdriver/blob/list-interrupt/transcripts/54-fix-list-interrupt.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block quotes don't interrupt paragraphs

1 participant