tryParseMarkdownToBlocks throws on a numbered or check list item that starts with <details>
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- html, markdown, typescript
- Ambito
- frontend
Direzione di ricerca
Start by reproducing with editor.tryParseMarkdownToBlocks("1. <details>") and checking the HTML from markdownToHTML for the same input. The likely cause is the toggle list item's details parse rule matching inside numbered and check list items, which leaves a blockContainer with a blockGroup but no blockContent. Done when the table's throwing inputs return blocks without error, and Markdown from blocksToMarkdownLossy loads again.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What’s broken?
editor.tryParseMarkdownToBlocks throws when a numbered or check list item starts with a <details> tag:
Error: blockContainer node does not contain a blockContent node in its children: blockContainer(blockGroup(blockContainer(paragraph)))
The editor can produce this Markdown itself. Type <details> as plain text in a numbered list item, and blocksToMarkdownLossy exports 1. <details>. Loading that export back throws, so a document saved as Markdown can no longer be opened.
| Markdown | Result |
|---|---|
1. <details> |
throws |
- [ ] <details> |
throws |
1. <details> followed by indented <summary>s</summary>, body, </details> |
throws |
- <details> |
ok (toggleListItem) |
<details> |
ok (toggleListItem) |
1. text <details> |
ok (numberedListItem) |
1. <div> |
ok (numberedListItem) |
1. <summary> |
ok (numberedListItem) |
markdownToHTML("1. <details>") gives <ol><li><p><details></p></li></ol>. My guess is that the toggle list item's details parse rule matches inside a numbered or check list item and leaves the outer blockContainer with a blockGroup but no blockContent.
What did you expect to happen?
tryParseMarkdownToBlocks returns blocks for any Markdown, keeping what it cannot represent as text. At the least, Markdown that blocksToMarkdownLossy wrote should load again.
Steps to reproduce
Default schema, no extensions:
import { BlockNoteEditor } from "@blocknote/core";
const editor = BlockNoteEditor.create();
// 1. Parsing throws.
editor.tryParseMarkdownToBlocks("1. <details>");
// 2. The editor's own export does not load again.
editor.replaceBlocks(editor.document, [
{ type: "numberedListItem", content: "<details>" },
]);
const markdown = editor.blocksToMarkdownLossy(editor.document); // "1. <details>\n"
editor.tryParseMarkdownToBlocks(markdown); // throws
In an app: type 1. and then <details> in an editor, save the document with blocksToMarkdownLossy, and load it with tryParseMarkdownToBlocks.
BlockNote version
v0.55.0 (also v0.54.0)
Environment
Chromium 151 on macOS 15 with React 19 (v0.54.0), and Node 24 with jsdom 30 (v0.54.0 and v0.55.0). Same error in both.
Additional context
Possibly related to #1711, which reported the same error message for a different input and was closed as working.
- Lingua principale
- TypeScript
- Stelle
- 10.3k
- Fork
- 777
- Merge medio
- 2g 18h
- PR unite (30g)
- 41
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TypeCellOS/BlockNote
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
TypeCellOS/BlockNote#2949 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
a11y
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
TypeCellOS/BlockNote#2855 ·
I maintainer di solito rispondono entro 1 giorno
-
a11y
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
TypeCellOS/BlockNote#2829 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Comment thread actions: hover-only controls and unlabeled buttons in ThreadsSidebaForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaa11y
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
TypeCellOS/BlockNote#2824 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
TypeCellOS/BlockNote#3209 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TypeCellOS/BlockNote
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Chocobozzz/PeerTube#7832 ·
I maintainer di solito rispondono entro 3 giorni
-
Pay to use?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
darkreader/darkreader#16108 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Add: Dak Nong TV SDApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug engine
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
frostney/GocciaScript#1746 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
agilepathway/label-checker#739 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno