tryParseMarkdownToBlocks throws on a numbered or check list item that starts with <details>
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- html, markdown, typescript
- 领域
- frontend
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 10.3k
- 派生
- 777
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 41
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TypeCellOS/BlockNote 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
TypeCellOS/BlockNote#2949 · 1 条评论 ·
维护者通常 1 天内回复
-
a11y
难度 2/5 1-3 小时 新手友好度 68/100
TypeCellOS/BlockNote#2855 ·
维护者通常 1 天内回复
-
a11y
难度 2/5 1-3 小时 新手友好度 62/100
TypeCellOS/BlockNote#2829 · 1 条评论 ·
维护者通常 1 天内回复
-
Comment thread actions: hover-only controls and unlabeled buttons in ThreadsSideba可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭a11y
难度 2/5 1-3 小时 新手友好度 72/100
TypeCellOS/BlockNote#2824 ·
维护者通常 1 天内回复
-
needs-triage
难度 3/5 半天 新手友好度 62/100
TypeCellOS/BlockNote#3209 ·
维护者通常 1 天内回复
查看 TypeCellOS/BlockNote 的全部 Issue
相似的 Issue
-
The inspector never shows the instances field, so scaling out is unreachable可能已有人在做 @Mrkewl 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
xevrion/breakscale#96 ·
维护者通常 4 天内回复
-
Object parameters lose their structure when resources is enabled可能已有人在做 @asts-top 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
rossant/awesome-math#199 ·
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
jaegertracing/jaeger-ui#4618 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
mifi/lossless-cut#3125 ·
维护者通常 1 天内回复