Skip to content

Add BlockQuoteDivExtension (::: > fenced blockquote)#250

Open
dereuromark wants to merge 4 commits into
masterfrom
feat/blockquote-div-extension
Open

Add BlockQuoteDivExtension (::: > fenced blockquote)#250
dereuromark wants to merge 4 commits into
masterfrom
feat/blockquote-div-extension

Conversation

@dereuromark

@dereuromark dereuromark commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What

Adds an opt-in BlockQuoteDivExtension: a ::: div whose only token is > produces a semantic <blockquote>, the fenced analog of the existing ::: | line block.

::: >
Notes from the meeting:

- item one
- item two
:::
<blockquote>
<p>Notes from the meeting:</p>
<ul>
<li>
item one
</li>
<li>
item two
</li>
</ul>
</blockquote>

The verbose >-prefix form produces the identical output, but needs the marker on every line - the prose line, the blank separator, and each list item:

> Notes from the meeting:
>
> - item one
> - item two

The two are interchangeable; the fenced form just drops the per-line >. The gap grows with the content - a quote wrapping a fenced code block or a table needs a > on every one of those lines too.

Why

The >-prefix block quote is comfortable for prose, where lazy continuation lets you drop the marker on wrapped lines. It is not comfortable when the quote contains block structure (a list, a nested fence, a table), because lazy continuation folds only plain paragraph text into a quote, never new block structure. Every list item and nested block then needs its own >, which is tedious to write and error-prone to edit.

The fenced form removes the per-line marker while keeping identical semantics. It mirrors the language-neutral design of the ::: | line block: a single sigil on the opener, no English keyword, no per-line prefix. Distinct from ::: quote, which stays an <aside class="admonition quote"> rather than a semantic blockquote.

Behavior

  • Output is identical to the >-prefix form: <blockquote>.
  • Caption: a ^ attribution line right after the closing ::: wraps the quote in <figure>/<figcaption>, reusing the core caption handler.
  • Attributes: a preceding {...} block attaches to the <blockquote> (consumed before the body is parsed, so an inner block cannot claim it; with a caption the attributes transfer onto the <figure>).
  • Nesting: longer colon runs nest, per djot div semantics.

Design note

No core parser change. Because > is not a meaningful class, a block-pattern hook intercepts the ::: > opener, collects the inner lines with the standard div-closer detection, and parses them as block content into a BlockQuote node, exactly the property that let ::: | ship as an extension.

Docs

  • docs/extensions/index.md - availability table row + a BlockQuoteDivExtension section.
  • docs/guide/syntax.md - pointer from the block-quote section.
  • docs/reference/enhancements.md - enhancement entry + feature-table row beside the line block.

A :::-div whose only token is > produces a semantic <blockquote> without a
per-line > marker, the fenced analog of the ::: | line block. This lets a quote
own block content (lists, nested fences, tables) where the >-prefix form needs
the marker on every line, since lazy continuation folds only plain paragraph
text into a quote, never new block structure.

Caption (^ after the close fence) and figure wrapping reuse the core caption
handler; preceding {...} attributes attach to the blockquote (consumed before
the body is parsed so an inner block cannot claim them); longer colon runs nest.
Opt-in, no core parser change.
@dereuromark dereuromark added the enhancement New feature or request label Jun 17, 2026
@dereuromark dereuromark changed the title Add BlockQuoteDivExtension (::: > fenced blockquote) Add BlockQuoteDivExtension (::: > fenced blockquote) Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.87234% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.42%. Comparing base (58a181a) to head (ed67124).

Files with missing lines Patch % Lines
src/Extension/BlockQuoteDivExtension.php 97.87% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #250      +/-   ##
============================================
+ Coverage     92.37%   92.42%   +0.04%     
- Complexity     3576     3588      +12     
============================================
  Files           107      108       +1     
  Lines         10129    10176      +47     
============================================
+ Hits           9357     9405      +48     
+ Misses          772      771       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant