Previously, enabling significantNewlines (either via constructor or DjotConverter::withSignificantNewlines()) would automatically set the soft break mode to SoftBreakMode::Break, rendering soft breaks as <br> tags.
These two features are now independent:
significantNewlines(parser option): Controls whether block elements can interrupt paragraphs without blank lines (markdown-like behavior)SoftBreakMode(renderer option): Controls how soft breaks are rendered (\n, space, or<br>)
If your code relies on withSignificantNewlines() rendering soft breaks as <br>, you need to explicitly set the soft break mode:
Before:
// This used to render soft breaks as <br>
$converter = DjotConverter::withSignificantNewlines();After:
use Djot\DjotConverter;
use Djot\Renderer\SoftBreakMode;
// Explicitly request <br> for soft breaks
$converter = DjotConverter::withSignificantNewlines(
softBreakMode: SoftBreakMode::Break,
);
// Or using the constructor:
$converter = new DjotConverter(
significantNewlines: true,
softBreakMode: SoftBreakMode::Break,
);The two features serve different purposes:
-
Significant newlines mode is for markdown compatibility - allowing lists, blockquotes, and headings to interrupt paragraphs without requiring blank lines.
-
Soft break mode is for controlling line break visibility - useful for poetry, chat messages, or anywhere users expect pressing Enter to create a visible line break.
Bundling them together was confusing because:
- The factory method name
withSignificantNewlines()didn't suggest it also changed soft break rendering - Users wanting markdown-style block interruption didn't necessarily want visible soft breaks (or vice versa)