Bug reportDec 2, 2026· 0:30· 7 views
tiptap: ordered-list code block gains a leading space on every Markdown round-trip (tiptap 3.31.3)
0:30 total
Comments · 0
Be the first to comment.
Bug reportby SceneRecap AI
medium@tiptap/extension-list Markdown parsing of ordered list item content. The indentation stripping for continuation lines appears to use marker.length+1 instead of the actual content offset.
os: macOScdn: esm.shdpr: 1locale: en-USbrowser: Chromium 151.0.7922.34packages: @tiptap/starter-kit + @tiptap/markdown 3.31.3timezone: Europe/Berlinviewport: 1280x720
Repro steps
- 1.Load the repro page with @tiptap/starter-kit and @tiptap/markdown 3.31.3 from esm.sh in Chromium.
- 2.Use the input Markdown '1. Item:' followed by an indented fenced code block that contains 'code line'.
- 3.Parse the Markdown into the editor and read the code block text (Round 0).
- 4.Round-trip once with getMarkdown then setContent, and read the code block text again (Round 1).
- 5.Repeat the round-trip two more times (Rounds 2 and 3) and compare the code block text.
Expected
The code block text is "code line" at every round, with no added leading whitespace. The summary at 23.0s states this expectation.
Actual
The initial parse yields "·code·line" (1 extra leading space). Each getMarkdown then setContent round-trip adds one more space: 2 at Round 1, 3 at Round 2 and 4 at Round 3.
Evidence
visualINPUT MARKDOWN shows '1. Item:' with an indented fenced code block containing 'code line'. The status reads 'tiptap 3.31.3 loaded'.
visualROUND 0, initial parse: code block text "·code·line", 1 extra leading space, flagged (bug).
visualROUND 1, after 1 round-trip (getMarkdown → setContent): "··code·line", 2 extra leading spaces, flagged (bug).
visualROUND 2, after 2 round-trips: "···code·line", 3 extra leading spaces, flagged (bug).
visualROUND 3, after 3 round-trips: "····code·line", 4 extra leading spaces, flagged (bug).
visualSummary: 'All 4 results flagged as bug. Expected: "code line" at every round.' The stated cause is that @tiptap/extension-list strips one fewer character from each indented code line (marker.length+1 instead of the real content offset).
Issue markdown (copy-paste ready)
## Summary A fenced code block inside an ordered list item gains one leading space when the Markdown is first parsed. It gains one more space on every `getMarkdown()` → `setContent()` round-trip. ## Environment - @tiptap/starter-kit + @tiptap/markdown 3.31.3 (esm.sh) - Chromium 151.0.7922.34, macOS, 1280x720 ## Steps to reproduce 1. Load tiptap 3.31.3 with StarterKit and the Markdown extension (1.0s). 2. Set this Markdown as content (1.0s): ```` 1. Item: ``` code line ``` ```` 3. Read the code block text after the initial parse (7.0s). 4. Run `getMarkdown()` then `setContent()` and read the text again. Repeat 3 times (11.0s, 15.0s, 19.0s). ## Expected The code block text is `"code line"` at every round. ## Actual | Round | Code block text | Extra spaces | t | |---|---|---|---| | 0 (initial parse) | `"·code·line"` | 1 | 7.0s | | 1 | `"··code·line"` | 2 | 11.0s | | 2 | `"···code·line"` | 3 | 15.0s | | 3 | `"····code·line"` | 4 | 19.0s | The page flags all 4 results as bugs (23.0s). The whitespace keeps growing, so the document drifts each time it is saved and loaded again. ## Suspected cause The repro page states (23.0s) that @tiptap/extension-list strips one fewer character than needed from each indented code line. It uses `marker.length+1` instead of the real content offset. For `1. ` with 3-space indentation, this leaves one space on the line. *Recorded with SceneRecap.*
This report was written by SceneRecap from a screen recording. Try SceneRecap free
Turn a screen recording into a bug report like this one.
Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.
Try SceneRecap free →