Skip to content

OrderedList markdown tokenizer swallows block math ($$) via lazy continuation #8166

Description

@Deuscx

Affected Packages

extension-list, extension-ordered-list, extension-mathematics, markdown

Tiptap Version

3.27.4

Browser Used

Chrome

What happened?

When Markdown has an ordered list item followed immediately by a $$ block math fence (no blank line), the formula is not parsed as blockMath.

It is absorbed into the list item as paragraph text (often with hard breaks). Bullet lists do not show this bug. Adding a blank line before $$ makes ordered lists work.

Minimal input:

4. **代入数值计算**
$$
\begin{align*}
x = 1
\end{align*}
$$

Actual result: one orderedList / listItem with plain text like $$, \begin{align*}, etc. No blockMath node.

Cause: OrderedList’s custom markdownTokenizer uses lazy continuation. PARAGRAPH_INTERRUPTERS covers headings, code fences, list markers, etc., but not $$. So an unindented $$ line is treated as paragraph continuation and only run through inlineTokens.

Expected Behavior

$$...$$ after an ordered list item should parse as blockMath, same as after a bullet list item or a normal paragraph. $$ should interrupt lazy continuation, similar to a code fence.

Reproducible Example URL (Optional)

No response

Additional Context (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: markdownMarkdown parsing and serializationstatus: triageNeeds initial review and categorization

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions