Skip to content

Add explicit AST transforms for heading shifts and inline footnotes#149

Merged
dereuromark merged 2 commits intomasterfrom
feature/transform-prototype
Mar 30, 2026
Merged

Add explicit AST transforms for heading shifts and inline footnotes#149
dereuromark merged 2 commits intomasterfrom
feature/transform-prototype

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

@dereuromark dereuromark commented Mar 30, 2026

Summary

  • add an explicit AST transform pipeline to DjotConverter
  • introduce HeadingLevelShiftTransform and InlineFootnotesToParenthesesTransform
  • keep InlineFootnotesExtension HTML-only and move non-HTML fallback behavior out of beforeRender() mutation
  • document explicit transform usage in the API and extension docs

Why this variant

  • keeps rendering pure: parse -> transform -> render
  • avoids hidden AST mutation during render()
  • avoids renderer-specific extension APIs and shared render-time option leakage
  • makes ownership explicit by returning transformed document copies

Prototype tradeoff

  • slower for one-shot parse+transform+render flows because the transform clones once up front
  • better suited to parse-once/render-many flows because rendering stays simple after the one-time transform

Verification

  • php vendor/bin/phpunit --colors=never
  • composer stan
  • composer cs-check

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.65%. Comparing base (0947440) to head (5bc7cfd).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/Transform/HeadingLevelShiftTransform.php 92.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #149      +/-   ##
============================================
- Coverage     93.69%   93.65%   -0.05%     
- Complexity     2642     2649       +7     
============================================
  Files            90       92       +2     
  Lines          6983     7002      +19     
============================================
+ Hits           6543     6558      +15     
- Misses          440      444       +4     

☔ 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 marked this pull request as ready for review March 30, 2026 05:34
@dereuromark dereuromark changed the title Add explicit AST transform pipeline Add explicit AST transforms for heading shifts and inline footnotes Mar 30, 2026
@dereuromark dereuromark merged commit d989abd into master Mar 30, 2026
5 of 6 checks passed
@dereuromark dereuromark deleted the feature/transform-prototype branch March 30, 2026 06:00
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