Skip to content

Add line block and raw inline round-trip support#158

Merged
dereuromark merged 3 commits intomasterfrom
feature/line-block-round-trip
Apr 1, 2026
Merged

Add line block and raw inline round-trip support#158
dereuromark merged 3 commits intomasterfrom
feature/line-block-round-trip

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

@dereuromark dereuromark commented Apr 1, 2026

Summary

Adds round-trip support for:

  1. Line blocks (| Line syntax) - detects div.line-block and converts back to pipe-prefixed lines
  2. Raw inline (`content`{=format} syntax) - wraps in span with data-djot-raw attribute

Line blocks

  • Add processLineBlock() to detect and convert div.line-block elements
  • Add extractLineBlockLines() to parse <br>-separated content
  • Add 3 round-trip tests

Raw inline

  • Modify HtmlRenderer.renderRawInline() to wrap content in span with data-djot-raw
  • Add processRawInline() and getInnerHtml() to HtmlToDjot
  • Add 3 round-trip tests (HTML, complex HTML, non-HTML format)
  • Update Round-Trip Limitations documentation

This is a follow-up to #157 which added extended round-trip support for other elements.

Adds round-trip support for line blocks (`| Line` syntax) by detecting
`div.line-block` in HtmlToDjot and converting back to pipe-prefixed lines.

- Add processLineBlock() to detect and convert div.line-block elements
- Add extractLineBlockLines() to parse br-separated content
- Add 3 round-trip tests for line blocks (simple, with formatting, with attributes)
- Update converters.md documentation
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 95.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.78%. Comparing base (51a4c33) to head (c2e081f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Converter/HtmlToDjot.php 95.16% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #158      +/-   ##
============================================
+ Coverage     93.74%   93.78%   +0.04%     
- Complexity     2980     3007      +27     
============================================
  Files            92       92              
  Lines          7691     7758      +67     
============================================
+ Hits           7210     7276      +66     
- Misses          481      482       +1     

☔ 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.

Adds round-trip support for raw inline content (`\`content\`{=format}` syntax)
by wrapping in a span with data-djot-raw attribute.

- Modify HtmlRenderer.renderRawInline() to wrap content in span with data-djot-raw
- Add processRawInline() and getInnerHtml() to HtmlToDjot
- Add 3 round-trip tests for raw inline (HTML, complex HTML, non-HTML format)
- Update Round-Trip Limitations documentation with escaped chars and abbreviations
@dereuromark dereuromark changed the title Add line block round-trip support Add line block and raw inline round-trip support Apr 1, 2026
@dereuromark dereuromark merged commit 60e5532 into master Apr 1, 2026
4 checks passed
@dereuromark dereuromark deleted the feature/line-block-round-trip branch April 1, 2026 15:34
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