mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
* fix: only let a non-empty list starting with 1 interrupt a paragraph in a list item Inside a list item, paragraph lines are lexed as text tokens, and the list tokenizer ran before the text tokenizer without checking whether the list may interrupt the paragraph, so `14.` or an empty `*` on the next line started a nested list. Apply the same rule as the paragraph interrupt: only a non-empty list starting with a bullet or 1 can interrupt a paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: move the list interrupt check into the list tokenizer The lexer passes its tokens to `list(src, tokens)`, and the tokenizer checks the last one, so `list(src)` overrides keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: keep the block tokens in the lexer state for the list tokenizer `blockTokens` sets `this.lexer.state.tokens` to the tokens it is lexing and restores the outer ones when it returns, so `list(src)` keeps its signature and checks the token before it from the state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: keep only the last block token in the lexer state `blockTokens` records the last token of the run it is lexing in `this.lexer.state.lastToken` before each tokenizer runs, and restores the outer one when a nested call returns, so the list tokenizer checks `state.lastToken` instead of the whole token list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>