You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
softBreakMode: SoftBreakMode::Break, // Optional: visible line breaks
287
287
);
288
288
```
@@ -361,13 +361,13 @@ Output:
361
361
| Nested blocks in list items without a blank line | No |**Yes**| Yes |
362
362
| Block elements interrupt top-level paragraphs | No | No | Yes |
363
363
364
-
Note: `significantNewlines` is deprecated; it enables both `blocksInterruptParagraphs` and `nestedBlocksInLists`. Prefer setting the two granular levers directly.
364
+
Note: `significantNewlines` is deprecated; it enables both `blocksInterruptParagraphs` and `nestedListsWithoutBlankLine`. Prefer setting the two granular levers directly. (`nestedBlocksInLists` is a separate, also-deprecated broad lever - it is no longer what `significantNewlines` sets.)
365
365
366
366
## Block Interrupts Paragraphs Mode
367
367
368
-
`blocksInterruptParagraphs`is the complementary counterpart to [Nested Blocks in Lists](#nested-blocks-in-lists-mode) mode. It allows top-level block elements — lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences — to interrupt a paragraph without a preceding blank line. It does **not**enable nesting inside list items (that is `nestedBlocksInLists`).
368
+
`blocksInterruptParagraphs` allows top-level block elements - lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences - to interrupt a paragraph without a preceding blank line. It **also** interrupts a list item's lead paragraph, so an indented non-list block (blockquote, heading, fenced code, or thematic break) nests inside the open item without a blank line. It does **not**nest a sublist inside a list item - that requires [Nested Lists Without Blank Line](#nested-lists-without-blank-line-mode) mode.
369
369
370
-
Use it when you want markdown-like top-level interruption but otherwise spec-compliant djot: indented content inside a list item still requires a blank line.
370
+
Use it when you want markdown-like top-level interruption and non-list nesting in list items, but otherwise spec-compliant djot: a sublist under a list item still requires a blank line.
371
371
372
372
### Enabling Block Interrupts Paragraphs Mode
373
373
@@ -408,19 +408,41 @@ two
408
408
</ul>
409
409
```
410
410
411
-
But indented content inside a list item does **not** nest (this is what differs from significant newlines mode):
411
+
A non-list block also nests inside a list item without a blank line. For example, a blockquote under the item:
In-list interruption uses the **same** lone-marker lookahead as the top-level path: an ambiguous single-line marker (`>` comparison, `|`, a lone bullet) stays literal, while unambiguous openers (`#`, fenced code, `:::`, `---`) and real multi-line blocks nest. So `- Item\n > quote` (a single `>` line) keeps `> quote` as literal text, exactly as `Foo\n> quote` does at the top level.
432
+
433
+
A sublist does **not** nest with this flag alone (that requires [Nested Lists Without Blank Line](#nested-lists-without-blank-line-mode) mode):
| Block elements interrupt top-level paragraphs | No |**Yes**| Yes |
433
-
| Nested blocks in list items without a blank line | No | No | Yes |
455
+
| Non-list block nests in list item without a blank line | No |**Yes**| Yes |
456
+
| Sublist nests in list item without a blank line | No | No | Yes |
457
+
458
+
The two granular levers are independent. `blocksInterruptParagraphs` alone does not nest sublists; `nestedListsWithoutBlankLine` alone does not interrupt top-level paragraphs or nest non-list blocks. `significantNewlines` enables both simultaneously.
459
+
460
+
## Nested Lists Without Blank Line Mode
461
+
462
+
`nestedListsWithoutBlankLine` lets a sublist nest inside a list item without a blank line, while leaving everything else at the spec default. It nests **only** sublists: a non-list block (blockquote, heading, thematic break) under the item stays literal, and top-level paragraphs are **not** interrupted.
463
+
464
+
Use it when you want markdown-like nested lists but otherwise spec-compliant djot: top-level paragraphs still require a blank line before any block, and only sublists nest in list items.
| Sublist nests in list item without a blank line | No |**Yes**| No | Yes |
531
+
| Non-list block nests in list item without a blank line | No | No |**Yes**| Yes |
532
+
| Block elements interrupt top-level paragraphs | No | No | Yes | Yes |
434
533
435
-
The two granular levers are independent. `blocksInterruptParagraphs`alone does not nest list items; `nestedBlocksInLists`alone does not interrupt top-level paragraphs. `significantNewlines` enables both simultaneously.
534
+
Note: `blocksInterruptParagraphs`+ `nestedListsWithoutBlankLine` together equal the deprecated `significantNewlines`; the deprecated `nestedBlocksInLists`enables the two in-list rows (sublist + non-list block) without top-level interruption.
Copy file name to clipboardExpand all lines: docs/reference/api.md
+35-10Lines changed: 35 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ public function __construct(
27
27
?RendererInterface $renderer = null,
28
28
bool $nestedBlocksInLists = false,
29
29
bool $blocksInterruptParagraphs = false,
30
+
bool $nestedListsWithoutBlankLine = false,
30
31
)
31
32
```
32
33
@@ -35,19 +36,20 @@ public function __construct(
35
36
-`$strict`: When `true`, throws `ParseException` on parse errors (see [Error Handling](#error-handling)).
36
37
-`$safeMode`: When `true` or a `SafeMode` instance, enables XSS protection (see [Safe Mode](#safe-mode)).
37
38
-`$profile`: A `Profile` instance for feature restriction (see [Profiles](/guide/profiles)).
38
-
-`$significantNewlines`: **Deprecated.** Convenience shorthand for `blocksInterruptParagraphs: true, nestedBlocksInLists: true`. Prefer the two granular levers. See [Significant Newlines Mode](#significant-newlines-mode).
39
+
-`$significantNewlines`: **Deprecated.** Convenience shorthand for `blocksInterruptParagraphs: true, nestedListsWithoutBlankLine: true`. Prefer the two granular levers. See [Significant Newlines Mode](#significant-newlines-mode).
39
40
-`$softBreakMode`: Override how soft breaks are rendered. When `null`, uses the renderer's default (newline for HTML).
40
41
-`$roundTripMode`: When `true`, adds round-trip metadata for Djot→HTML→Djot workflows (HTML renderer only).
41
-
-`$parser`: Optional pre-configured parser. When provided, inline parser constructor flags such as `warnings`, `strict`, `significantNewlines` (deprecated), `nestedBlocksInLists`, and `blocksInterruptParagraphs` are ignored.
42
+
-`$parser`: Optional pre-configured parser. When provided, inline parser constructor flags such as `warnings`, `strict`, `significantNewlines` (deprecated), `nestedBlocksInLists`, `blocksInterruptParagraphs`, and `nestedListsWithoutBlankLine` are ignored.
42
43
-`$renderer`: Optional pre-configured renderer. When provided, inline renderer constructor flags such as `xhtml`, `safeMode`, `softBreakMode`, and `roundTripMode` are ignored.
43
-
-`$nestedBlocksInLists`: When `true`, indentation alone introduces nested blocks inside list items without a blank line, while top-level paragraph interruption stays spec-compliant (see [Nested Blocks in Lists Mode](/guide/parser-options#nested-blocks-in-lists-mode)). Implied by `$significantNewlines`.
44
-
-`$blocksInterruptParagraphs`: When `true`, top-level block elements (lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences) can interrupt a paragraph without a preceding blank line, while list-item nesting stays spec-compliant (see [Block Interrupts Paragraphs Mode](/guide/parser-options#block-interrupts-paragraphs-mode)). Implied by `$significantNewlines`.
44
+
-`$nestedBlocksInLists`: **Deprecated.** When `true`, indentation alone introduces nested blocks of **any** type inside list items without a blank line (broad, eager - no lone-marker lookahead), while top-level paragraph interruption stays spec-compliant (see [Nested Blocks in Lists Mode](/guide/parser-options#nested-blocks-in-lists-mode)). Prefer `$blocksInterruptParagraphs` + `$nestedListsWithoutBlankLine`. No longer implied by `$significantNewlines`.
45
+
-`$blocksInterruptParagraphs`: When `true`, top-level block elements (lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences) can interrupt a paragraph without a preceding blank line. It **also** interrupts a list item's lead paragraph, so an indented non-list block nests inside the item without a blank line, using the **same** lone-marker lookahead as the top level: unambiguous openers (`#`, fenced code, `:::`, `---`) and real multi-line blocks nest, while a single ambiguous marker line (`>`, `|`) stays literal. It does not nest sublists (see [Block Interrupts Paragraphs Mode](/guide/parser-options#block-interrupts-paragraphs-mode)). Implied by `$significantNewlines`.
46
+
-`$nestedListsWithoutBlankLine`: When `true`, a sublist nests inside a list item without a blank line. Only sublists nest; non-list blocks under the item stay literal and top-level paragraph interruption is unaffected (see [Nested Lists Without Blank Line Mode](/guide/parser-options#nested-lists-without-blank-line-mode)). Implied by `$significantNewlines`.
45
47
46
48
### Factory Methods
47
49
48
50
#### withSignificantNewlines()
49
51
50
-
> **Deprecated.** Prefer using `new DjotConverter(blocksInterruptParagraphs: true, nestedBlocksInLists: true)` or the two dedicated factory methods. See [Significant Newlines Mode](/guide/parser-options#significant-newlines-mode).
52
+
> **Deprecated.** Prefer using `new DjotConverter(blocksInterruptParagraphs: true, nestedListsWithoutBlankLine: true)` or the two dedicated factory methods. See [Significant Newlines Mode](/guide/parser-options#significant-newlines-mode).
51
53
52
54
```php
53
55
public static function withSignificantNewlines(
@@ -61,7 +63,7 @@ public static function withSignificantNewlines(
61
63
): self
62
64
```
63
65
64
-
Creates a converter with significant newlines mode enabled (equivalent to `blocksInterruptParagraphs: true` + `nestedBlocksInLists: true`). See [Significant Newlines Mode](/guide/parser-options#significant-newlines-mode).
66
+
Creates a converter with significant newlines mode enabled (equivalent to `blocksInterruptParagraphs: true` + `nestedListsWithoutBlankLine: true`). See [Significant Newlines Mode](/guide/parser-options#significant-newlines-mode).
65
67
66
68
#### withNestedBlocksInLists()
67
69
@@ -93,7 +95,23 @@ public static function withBlocksInterruptParagraphs(
93
95
): self
94
96
```
95
97
96
-
Creates a converter that allows top-level block elements (lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences) to interrupt a paragraph without a preceding blank line, while list-item nesting stays spec-compliant. See [Block Interrupts Paragraphs Mode](/guide/parser-options#block-interrupts-paragraphs-mode).
98
+
Creates a converter that allows top-level block elements (lists, blockquotes, headings, tables, thematic breaks, and code/div/comment fences) to interrupt a paragraph without a preceding blank line, and nests indented non-list blocks inside list items without a blank line. Sublist nesting stays spec-compliant. See [Block Interrupts Paragraphs Mode](/guide/parser-options#block-interrupts-paragraphs-mode).
99
+
100
+
#### withNestedListsWithoutBlankLine()
101
+
102
+
```php
103
+
public static function withNestedListsWithoutBlankLine(
104
+
bool $xhtml = false,
105
+
bool $warnings = false,
106
+
bool $strict = false,
107
+
bool|SafeMode|null $safeMode = null,
108
+
?Profile $profile = null,
109
+
?SoftBreakMode $softBreakMode = null,
110
+
bool $roundTripMode = false,
111
+
): self
112
+
```
113
+
114
+
Creates a converter that nests a sublist inside a list item without requiring a blank line. Only sublists nest; non-list blocks under the item stay literal and top-level paragraph interruption stays at the spec default. See [Nested Lists Without Blank Line Mode](/guide/parser-options#nested-lists-without-blank-line-mode).
0 commit comments