refactor: simplify spark table detection logic

This commit is contained in:
hypercross 2026-07-11 09:56:18 +08:00
parent 6d0bd75cb6
commit 841fbc7bae
1 changed files with 2 additions and 10 deletions

View File

@ -208,16 +208,8 @@ export function scanDirectives(
const [, headerRow, separatorRow, bodyRowsText] = mdMatch; const [, headerRow, separatorRow, bodyRowsText] = mdMatch;
const headers = splitTableRow(headerRow); const headers = splitTableRow(headerRow);
// Check if this is a spark-shaped table: first column is a dice formula // Check if this looks like a spark table: first column is a dice formula
// and one of the headers is a label marker const isSpark = DICE_HEADER_RE.test(headers[0]);
const isSpark =
DICE_HEADER_RE.test(headers[0]) &&
headers.some(
(h) =>
h === "label" ||
h === "md-table-label" ||
h === "md-roll-label",
);
if (!isSpark) continue; if (!isSpark) continue;