Preserve medial gaps in ::: | line blocks#244
Merged
Conversation
LineBlockDivExtension preserved only leading indentation; medial and trailing runs of two or more spaces were collapsed by normal inline parsing. That dropped the alignment gaps verse relies on - the caesura of Old English verse, aligned columns in an address - exactly the inconsistency raised on djot#29. Now preserve every leading run plus any inner or trailing run of two or more columns as non-breaking spaces; a single inner space stays an ordinary, collapsible space so long lines can still wrap. Tabs expand to four-column stops. Renders as a non-breaking space in every format: (HTML), U+00A0 (Markdown), ordinary space (plain text / ANSI).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #244 +/- ##
============================================
+ Coverage 92.04% 92.05% +0.01%
- Complexity 3559 3566 +7
============================================
Files 107 107
Lines 10078 10093 +15
============================================
+ Hits 9276 9291 +15
Misses 802 802 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dereuromark
added a commit
to markup-carve/carve-php
that referenced
this pull request
Jun 12, 2026
Port of php-collective/djot-php#244. The line block preserved only LEADING indentation; inner and trailing runs of two or more columns (medial gaps - inline alignment such as the caesura of Old English verse) were collapsed by normal inline parsing. Now they are preserved too, via the U+E000 placeholder, while a lone inner space stays an ordinary collapsible space so a long line can still wrap between words. Matches Pandoc's line-block definition (every space the author writes is significant) and Omikhleia's point on jgm/djot#29.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #243. The
LineBlockDivExtensionpreserved only leading indentation; medial and trailing runs of two or more spaces were collapsed by normal inline parsing - so a verse lost the alignment gaps it depends on.This is the inconsistency Omikhleia raised on djot#29: a line block whose whole point is significant whitespace should keep the medial gap too, not just the leading indent. The canonical example is the caesura of Old English verse:
renders (HTML) with the gaps intact:
Rule
This matches Pandoc's line-block definition (every space the author writes is significant) while keeping ordinary word spacing wrappable.
Implementation
splitLeadingWhitespacewith a singleappendLinepass that walks each line, emitting preserved columns via the existing internal non-breaking-space placeholder (U+E000) and inline-parsing the text segments between gaps. in HTML, real U+00A0 in Markdown (survives round-trip, never read as indented code), ordinary space in plain text / ANSI. Tabs expand to four-column stops.Docs
docs/extensions/index.md: medial-gap rule + Beowulf example.docs/guide/syntax.md: cross-reference updated.