Skip to content

Listes : garder dans le même item des sous-listes consécutives de types différents - #54

Open
jmcollin wants to merge 4 commits into
mainfrom
fix/mixed-nested-lists
Open

jmcollin wants to merge 4 commits into
mainfrom
fix/mixed-nested-lists

Conversation

@jmcollin

@jmcollin jmcollin commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Empilée sur #49 (listes). Merger #49 d'abord : ses commits apparaissent ici tant qu'elle n'est pas dans main.

Problème (point 17 de la review)

- a
  1. b
  - c
- d

Sortie avant : trois listes séparées, <ul><li>a<ol>…</ol></li></ul><ul><li>c</li></ul><ul><li>d</li></ul>. L'item a ne gardait que sa première sous-liste. La sous-liste à puces c et l'item frère d repartaient au niveau supérieur.

Correctif

Parser::buildList() rattache à l'item toutes les sous-listes plus profondes qui le suivent, et plus seulement la première. Ces sous-listes sont distinctes, car changer de type ou de puce démarre une nouvelle liste (§5.3).

Sortie : <ul><li>a<ol><li>b</li></ol><ul><li>c</li></ul></li><li>d</li></ul>. C'est la même structure que markdown-it.

Tests

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe


Generated by Claude Code

claude added 4 commits October 8, 2026 10:00
…d continuation lines

- depth is computed from the open items' content columns (CommonMark
  §5.2) instead of floor(indent / 2): "10. a\n    - b" nests b under a,
  and a lone "  - item" is a top-level item
- ordered lists keep their start number (<ol start="3">) and accept the
  ')' delimiter; changing the bullet char or delimiter starts a new list
- paragraph text right after an item (indented or lazy) continues the
  item instead of ending the list
- outside a list, a marker indented 4+ columns is indented code (or
  paragraph text), and an ordered item not starting at 1 cannot
  interrupt a paragraph
- continuation lines are joined once at the end and the "list open"
  check is cached, so both stay linear

Four lexer tests asserted the old floor(indent / 2) depth for a lone
indented item; they now nest the item under a real parent.

CommonMark spec: List items 10/48 -> 17/48, Lists 6/26 -> 11/26.
Multi-block items (several paragraphs, code inside an item) are not
supported yet and account for most remaining failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
Conflicts in src/Lexer/Lexer.php with the blockquote laziness change
(#44) and table detection (#45), all side-by-side additions:
- quote pattern from main, list patterns from this branch
- both state blocks (quote laziness, open list columns)
- quote lazy continuation first, then list item continuation
- list item placement before table detection (it may turn an item into
  a paragraph line)

Also drops the PATTERN_TABLE_SEPARATOR reference left by #44 (same
change as #50), without which every blockquote throws on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
…uation

startsBlock() (lists) duplicated the block-start checks of
isParagraphContinuation() (blockquote laziness, merged meanwhile).
List continuation now uses the shared helper; footnote definitions
still end an item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
… item

A list item followed by an ordered sub-list and then a bullet sub-list
("- a\n  1. b\n  - c\n- d") only kept the first sub-list: the bullet
one and every later sibling were split into new top-level lists.
buildList() now attaches every deeper list that follows the item, not
just the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
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.

2 participants