Decouple SoftBreakMode from significantNewlines#141
Merged
dereuromark merged 3 commits intomasterfrom Mar 29, 2026
Merged
Conversation
Previously, enabling significantNewlines would automatically set SoftBreakMode::Break. These two features serve different purposes: - significantNewlines: markdown-like block interruption (parser) - SoftBreakMode: visible line breaks (renderer) They are now independent. Users wanting the previous behavior should explicitly pass softBreakMode: SoftBreakMode::Break. This is a breaking change - see UPGRADE.md for migration guide.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #141 +/- ##
============================================
- Coverage 94.21% 94.21% -0.01%
+ Complexity 2570 2569 -1
============================================
Files 88 88
Lines 6847 6845 -2
============================================
- Hits 6451 6449 -2
Misses 396 396 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
SoftBreakMode::BreakwhensignificantNewlinesis enabledsignificantNewlines: markdown-like block interruption (parser behavior)SoftBreakMode: visible line breaks (renderer behavior)Breaking Change
Users relying on
withSignificantNewlines()to render soft breaks as<br>need to explicitly set the mode:See
UPGRADE.mdfor full migration guide.Rationale
The previous bundling was confusing because:
Additionally,
SoftBreakMode::Breakis rarely needed in Djot because hard breaks are simple and visible:Compare to Markdown's awkward options:
<br>HTML tag (verbose)In Djot, if you want visible line breaks, you explicitly add
\- it's intentional and clear. This makesSoftBreakMode::Breaka niche feature for specific use cases like importing content or poetry/lyrics where adding\to every line would be tedious.