Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(open-knowledge): structural table-serialize edges from state-space eval (#2413)
Nick Gomez8f20b4c85d39
diff --git a/.changeset/table-cell-line-breaks.md b/.changeset/table-cell-line-breaks.mdindex bbe12132a..932e55fd7 100644--- a/.changeset/table-cell-line-breaks.md+++ b/.changeset/table-cell-line-breaks.md@@ -6,4 +6,4 @@ Fix tables corrupting for collaborators when a cell holds multi-line content.Pressing Enter, Shift+Enter, or adding a list inside a table cell used to serialize raw newlines into the markdown row — the table stayed intact in your own editor but split into a truncated table plus stray bullet lines for everyone else re-opening the file (teammates, restarts, fresh checkouts), and adjacent lines could glue together with their boundary lost. Multi-line cell content now serializes to single-line GFM rows joined by `<br />`, the standard idiom GitHub renders as a line break: extra paragraphs become line breaks, list items keep a `- ` (or `1. `) marker on their own visual line, and nothing in the row ever emits a raw newline. The same guard covers Shift+Enter inside headings.-In the other direction, `<br>`, `<br/>`, and `<br />` in markdown now parse as real line breaks in the editor instead of showing as literal angle-bracket text, and each spelling is preserved byte-for-byte on save. Backslash-escaped `\<br />` and `<br>` inside inline code stay literal, as authored.+In the other direction, `<br>`, `<br/>`, and `<br />` in markdown now parse as real line breaks in the editor instead of showing as literal angle-bracket text, and each spelling is preserved byte-for-byte on save. Backslash-escaped `\<br />` and `<br>` inside inline code stay literal, as authored. A structurally empty table (no cells) now serializes to nothing instead of junk `||` bytes that reparsed as a text paragraph, and a childless component inside a cell now fires the structured drop event instead of vanishing silently.diff --git a/packages/core/src/markdown/table-cell-flatten.ts b/packages/core/src/markdown/table-cell-flatten.tsindex d2915bfc1..48a434f4e 100644--- a/packages/core/src/markdown/table-cell-flatten.ts+++ b/packages/core/src/markdown/table-cell-flatten.ts@@ -114,7 +114,7 @@ export function flattenCellBlocks(children: readonly Nodes[]): PhrasingContent[]return;default: {const withChildren = node as { children?: Nodes[] };- if (Array.isArray(withChildren.children)) {+ if (Array.isArray(withChildren.children) && withChildren.children.length > 0) {withChildren.children.forEach((child, i) => {if (i > 0) pushBreak();pushBlock(child);diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.tsindex fc8d29987..1a2fb5d50 100644--- a/packages/core/src/markdown/to-markdown-handlers.ts+++ b/packages/core/src/markdown/to-markdown-handlers.ts@@ -471,6 +471,11 @@ export const toMarkdownHandlers = {const bodyWidth = matrix.slice(1).reduce((m, r) => Math.max(m, r.length), 0);const mostCellsPerRow = Math.max(headerWidth, bodyWidth, alignArr.length);+ if (mostCellsPerRow === 0) {+ console.warn(JSON.stringify({ event: 'table-serialize-dropped-empty', rows: rows.length }));+ return '';+ }+const alignmentCells: string[] = [];for (let col = 0; col < mostCellsPerRow; col++) {const align = alignArr[col];