Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Cursor version: 3.17.19 (commit ae3a2b7231dd)
OS: macOS (Darwin 25.6.0)
Switching a markdown file to Preview mode silently drops everything from a section onward — the document just ends early, with no visible error in the UI. The same file renders correctly on GitHub and in the classic VS Code markdown preview.
The trigger is a numbered list item whose nested bullets are indented 4 spaces and are followed by a blank line and more indented content. Developer Tools console shows an uncaught exception:
Uncaught RangeError: Invalid content for node listItem: <"First bullet with some `
at checkContent (workbench.desktop.main.js:471)
at check (workbench.desktop.main.js:470)
...
Note the raw backtick in the message — the text reaches ProseMirror without inline parsing.
Root cause (from debugging the minified bundle) — two defects combine:
-
The custom ordered-list re-tokenizer strips a hard-coded 2 spaces from continuation lines (the markdown-to-editor conversion in
workbench.desktop.main.jsre-lexes numbered list item bodies, slicingmarker indent + 2characters off each continuation line regardless of the actual content indentation). With standard 4-space-indented child content, 2 stray spaces survive, so when the item body is re-lexed with marked, bullets 2..n and any following paragraphs/fences are absorbed into the first bullet, making it a loose item with mixedtextandparagraphtokens. -
The listItem converter emits bare text nodes for that mix. When a marked
list_itemtoken contains bothtextandparagraphchildren, the converter passes all children through generic conversion, and the leadingtexttoken becomes a bare inline text node (raw, not inline-parsed) directly inside alistItemnode whose schema isparagraph block*. ProseMirror’s validation throws the RangeError, the exception is uncaught, and the rest of the document never renders.
The same mechanism fires for other shapes, e.g. a fenced code block indented inside a bullet that is itself inside a numbered item (item tokens text, code, text).
Impact: silent truncation — no error surfaces to the user, so documents look complete when they aren’t. 4-space indentation under numbered items is extremely common (it’s what many formatters and CommonMark tutorials produce) and renders identically to 3-space on GitHub, so affected users have no reason to suspect their markdown.
Workaround: indent nested bullets under numbered list items by 3 spaces instead of 4, and keep fenced code blocks at the numbered-item level rather than nested inside bullets.
Suggested fixes:
- Strip the actual measured content indentation (not a hard-coded 2) when re-lexing ordered list item bodies.
- In the listItem converter, wrap any bare
texttoken in a paragraph before inserting intolistItem(schemaparagraph block*). - Catch conversion/validation errors and render a fallback (or surface an error) instead of silently truncating the document.
Steps to Reproduce
-
Create
repro.mdwith exactly this content (bullet indentation is 4 spaces — that detail matters):# Repro 1. **Step one**: this list item breaks Preview: - First bullet with some `inline code` in it. - Second bullet. A follow-up paragraph inside the numbered item. ## You should see this heading But in Preview, everything from the section containing the list disappears. -
Open the file in Cursor and switch to Preview mode.
-
Observe the document is truncated; open Developer Tools (Help → Toggle Developer Tools) to see the uncaught
RangeError.
Expected Behavior
The whole document renders in Preview mode, including the numbered list, its nested bullets, and all following sections — matching how GitHub and VS Code’s webview markdown preview render the identical file. If conversion of a node fails, the error should surface to the user rather than silently truncating the document.
Operating System
MacOS
Version Information
3.17.19 (commit ae3a2b7231dd)
Does this stop you from using Cursor
No - Cursor works, but with this issue