refactor: simplify spark table detection logic
This commit is contained in:
parent
6d0bd75cb6
commit
841fbc7bae
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue