Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 2x 2x 2x 2x 2x 1x 1x 2x 2x 2x 2x 2x 2x 1x 1x 2x 1x 1x 2x 2x 2x | import { parse as parseYaml } from "yaml" export function extractFrontmatter(raw: string): string | null { const t = raw.replace(/^\uFEFF/, "") if (!t.startsWith("---")) { return null } const end = t.indexOf("---", 3) return end === -1 ? null : t.slice(3, end).trim() } export function parseFrontmatterRecord(raw: string): Record<string, unknown> | null { const fm = extractFrontmatter(raw) if (!fm) { return null } try { return parseYaml(fm) as Record<string, unknown> } catch { return null } } export function parseStringList(value: unknown): string[] { if (Array.isArray(value)) { return value.filter((v): v is string => typeof v === "string") } if (typeof value === "string") { return value .split(/[,\s]+/) .map((s) => s.trim()) .filter(Boolean) } return [] } |