Skip to content

FrontmatterExtension: Support block attributes and spaced syntax#124

Merged
dereuromark merged 1 commit intomasterfrom
frontmatter-block-attributes
Mar 24, 2026
Merged

FrontmatterExtension: Support block attributes and spaced syntax#124
dereuromark merged 1 commit intomasterfrom
frontmatter-block-attributes

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

@dereuromark dereuromark commented Mar 24, 2026

Summary

  • Adds consumePendingAttributes() to BlockParser for extensions to access pending block attributes
  • FrontmatterExtension now supports standard djot block attribute syntax on the line above
  • Removes inline attribute syntax (---yaml {.meta}) in favor of standard djot block attributes

New Syntax

Block attributes are placed on the preceding line (standard djot style):

{.meta #frontmatter}
---yaml
title: My Document
---

{kernel="myproject" #cell-1}
---python
import flight
---

Follow-up to #122, based on discussion in jgm/djot#35.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.92%. Comparing base (36dbbcb) to head (e27b71c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #124   +/-   ##
=========================================
  Coverage     93.92%   93.92%           
- Complexity     2382     2383    +1     
=========================================
  Files            81       81           
  Lines          6303     6306    +3     
=========================================
+ Hits           5920     5923    +3     
  Misses          383      383           

☔ View full report in Codecov by Sentry.
📢 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.

@dereuromark dereuromark force-pushed the frontmatter-block-attributes branch from 6a4d4b6 to 2a20d91 Compare March 24, 2026 22:40
- Add consumePendingAttributes() to BlockParser for extensions to access
  pending block attributes defined on preceding lines
- Support standard djot block attribute syntax: {.class} on line above
  the frontmatter opener now attaches to the frontmatter block
- Remove inline attribute syntax (---yaml {.meta}) in favor of standard
  djot block attributes above

Follows discussion in jgm/djot#35.
@dereuromark dereuromark force-pushed the frontmatter-block-attributes branch from 2a20d91 to e27b71c Compare March 24, 2026 22:41
@dereuromark dereuromark merged commit 725d3e3 into master Mar 24, 2026
4 checks passed
@dereuromark dereuromark deleted the frontmatter-block-attributes branch March 24, 2026 22:43
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.

1 participant