feat: Unify spark table detection and content resolution

Export isSparkTableHeader from content-registry and use it in both CLI
and frontend table parsing. Add resolveContentRef to resolve content
references consistently. Write processed registry content back to the
file index so browser mode renders identically to CLI mode.
This commit is contained in:
hyper
2026-08-07 13:15:51 +08:00
parent 0a68122efd
commit c03528a293
7 changed files with 114 additions and 18 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import type { MarkedExtension, Tokens } from "marked";
import { isSparkTableHeader } from "../cli/content-registry";
/**
* 将表格数据转换为 CSV 格式字符串
@@ -35,7 +36,7 @@ export default function markedTable(): MarkedExtension {
let remix = "";
const labelIndex = header.findIndex((cell) => {
if (cell.text === "md-roll-label" || cell.text.match(/(\d+)?d\d+/)) {
if (cell.text === "md-roll-label" || isSparkTableHeader(cell.text)) {
roll = " roll=true";
return true;
} else if (cell.text === "md-remix-label") {