featherdown 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/rehypeCodeBlockTitles.ts","../src/internal/rehypeCodeLineHighlights.ts","../src/internal/chartTypes.ts","../src/internal/rehypeChartBlocks.ts","../src/internal/rehypeCdnImages.ts","../src/internal/headingIdsRemark.ts","../src/internal/remarkCallouts.ts","../src/internal/remarkCodeBlockTitles.ts","../src/internal/sanitizeSchema.ts","../src/internal/createMarkdownProcessorInternal.ts"],"names":["rehypeCodeBlockTitles","CHART_LANGUAGE_PREFIX","hasChartLanguage","rehypeCodeLineHighlights","visit","rehypeChartBlocks","nextSrc","remarkCodeBlockTitles"],"mappings":";;;;;;;;;;;;;;;;;AAIA,IAAM,qBAAA,GAAwB,iBAAA;AAC9B,IAAM,aAAA,GAAgB,YAAA;AACtB,IAAM,cAAA,GAAiB,qBAAA;AACvB,IAAM,iBAAA,GAAoB,wBAAA;AAE1B,SAAS,iBAAiB,SAAA,EAA6B;AACrD,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAA,GAClC,SAAA,GACA,OAAO,SAAA,KAAc,QAAA,GACnB,CAAC,SAAS,CAAA,GACV,EAAC;AACP,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,CAAC,KAAA,KAAU,OAAO,UAAU,QAAA,IAAY,KAAA,CAAM,UAAA,CAAW,qBAAqB,CAAC,CAAA;AACpG;AAKA,IAAM,qBAAA,GAA0C,SAASA,sBAAAA,GAAwB;AAC/E,EAAA,OAAO,CAAC,IAAA,KAAoB;AAC1B,IAAA,IAAI,eAAA,GAAkB,CAAA;AACtB,IAAA,KAAA,CAAM,IAAA,EAAM,SAAA,EAAW,CAAC,IAAA,EAAM,OAAO,MAAA,KAAW;AAC9C,MAAA,IAAI,IAAA,CAAK,YAAY,KAAA,EAAO;AAC5B,MAA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;AAE1E,EAAA,IAAI,KAAA,CAAM,IAAA,IAAQ,KAAA,CAAM,gBAAA,EAAkB;AACxC,IAAA,SAAA,CAAU,GAAA,CAAI,eAAe,CAAA,CAAE,GAAA,CAAI,gCAAwB,CAAA;AAAA,EAC7D;AAEA,EAAA,IAAI,CAAC,SAAS,6BAAA,EAA+B;AAC3C,IAAA,SAAA,CAAU,IAAI,gCAAgC,CAAA;AAAA,EAChD;AAEA,EAAA,SAAA,CAAU,GAAA,CAAI,eAAA,EAAyB,OAAO,CAAA,CAAE,IAAI,eAAe,CAAA;AAEnE,EAAA,OAAO,SAAA;AACT","file":"chunk-YKLQHPRB.js","sourcesContent":["import type { Element, Root } from 'hast';\nimport { visit } from 'unist-util-visit';\nimport type { Plugin } from 'unified';\n\nconst CHART_LANGUAGE_PREFIX = 'language-chart-';\nconst WRAPPER_CLASS = 'code-block';\nconst COPYABLE_CLASS = 'code-block-copyable';\nconst COPY_BUTTON_CLASS = 'code-block-copy-button';\n\nfunction hasChartLanguage(className: unknown): boolean {\n const values = Array.isArray(className)\n ? className\n : typeof className === 'string'\n ? [className]\n : [];\n return values.some((value) => typeof value === 'string' && value.startsWith(CHART_LANGUAGE_PREFIX));\n}\n\n/**\n * Wraps code blocks with stable title and copy-button markup.\n */\nconst rehypeCodeBlockTitles: Plugin<[], Root> = function rehypeCodeBlockTitles() {\n return (tree): undefined => {\n let copyTargetCount = 0;\n visit(tree, 'element', (node, index, parent) => {\n if (node.tagName !== 'pre') return;\n if (!parent || typeof index !== 'number') return;\n\n const code = node.children[0];\n if (!code || code.type !== 'element' || code.tagName !== 'code') return;\n if (hasChartLanguage(code.properties.className)) return;\n\n const title = code.properties.dataCodeBlockTitle;\n delete code.properties.dataCodeBlockTitle;\n const hasCopyButton =\n code.properties.dataCodeCopyButton === true ||\n code.properties.dataCodeCopyButton === 'true' ||\n code.properties.dataCodeCopyButton === '';\n delete code.properties.dataCodeCopyButton;\n\n if (typeof title !== 'string' && !hasCopyButton) return;\n\n const children: Element['children'] = [];\n if (typeof title === 'string') {\n children.push({\n type: 'element',\n tagName: 'div',\n properties: { className: ['code-block-title'] },\n children: [{ type: 'text', value: title }],\n });\n }\n\n const wrapperClassName = hasCopyButton ? [WRAPPER_CLASS, COPYABLE_CLASS] : [WRAPPER_CLASS];\n if (hasCopyButton) {\n copyTargetCount += 1;\n const copyTargetId = `code-copy-target-${String(copyTargetCount)}`;\n code.properties.dataCodeCopyTarget = copyTargetId;\n children.push({\n type: 'element',\n tagName: 'button',\n properties: {\n type: 'button',\n className: [COPY_BUTTON_CLASS],\n dataCodeCopy: '',\n dataCodeCopyTarget: copyTargetId,\n },\n children: [{ type: 'text', value: 'Copy' }],\n });\n }\n children.push(node);\n\n const wrapped: Element = {\n type: 'element',\n tagName: 'div',\n properties: { className: wrapperClassName },\n children,\n };\n\n parent.children[index] = wrapped;\n });\n };\n};\n\nexport default rehypeCodeBlockTitles;\n","import type { Element, ElementContent, Root, Text } from 'hast';\nimport { visit } from 'unist-util-visit';\nimport type { Plugin } from 'unified';\n\nconst CHART_LANGUAGE_PREFIX = 'language-chart-';\nconst CODE_LINE_CLASS = 'code-line';\nconst CODE_LINE_HIGHLIGHTED_CLASS = 'code-line-highlighted';\nconst CODE_LINE_NUMBERED_CLASS = 'code-line-numbered';\nconst CODE_LINE_NUMBER_CLASS = 'code-line-number';\n\nfunction hasChartLanguage(className: unknown): boolean {\n const values = Array.isArray(className)\n ? className\n : typeof className === 'string'\n ? [className]\n : [];\n return values.some((value) => typeof value === 'string' && value.startsWith(CHART_LANGUAGE_PREFIX));\n}\n\nfunction getHighlightLines(value: unknown): Set<number> {\n const lines = new Set<number>();\n\n if (Array.isArray(value)) {\n for (const item of value) {\n if (typeof item === 'number' && Number.isInteger(item) && item > 0) {\n lines.add(item);\n }\n if (typeof item === 'string' && /^\\d+$/.test(item)) {\n lines.add(Number(item));\n }\n }\n return lines;\n }\n\n if (typeof value === 'string') {\n for (const fragment of value.split(/[^\\d]+/)) {\n const trimmed = fragment.trim();\n if (/^\\d+$/.test(trimmed)) {\n lines.add(Number(trimmed));\n }\n }\n }\n return lines;\n}\n\nfunction getShowLineNumbers(value: unknown): boolean {\n return value === true || value === 'true' || value === '';\n}\n\nfunction ensureClassNameList(className: unknown): string[] {\n if (Array.isArray(className)) {\n return className.filter((entry): entry is string => typeof entry === 'string');\n }\n if (typeof className === 'string') {\n return [className];\n }\n return [];\n}\n\nfunction splitCodeChildrenIntoLines(children: ElementContent[]): ElementContent[][] {\n const lines: ElementContent[][] = [[]];\n for (const child of children) {\n if (child.type !== 'text') {\n const current = lines[lines.length - 1];\n if (!current) {\n continue;\n }\n current.push(child);\n continue;\n }\n\n const segments = child.value.split('\\n');\n for (let i = 0; i < segments.length; i += 1) {\n const segment = segments[i];\n if (segment && segment.length > 0) {\n const current = lines[lines.length - 1];\n if (!current) {\n continue;\n }\n current.push({ type: 'text', value: segment });\n }\n if (i < segments.length - 1) {\n lines.push([]);\n }\n }\n }\n return lines;\n}\n\nfunction isEmptyLine(line: ElementContent[]): boolean {\n return line.length === 0 || line.every((node) => node.type === 'text' && node.value.length === 0);\n}\n\n/**\n * Adds line-level wrappers and highlight classes for configured code ranges.\n */\nconst rehypeCodeLineHighlights: Plugin<[], Root> = function rehypeCodeLineHighlights() {\n return (tree): undefined => {\n visit(tree, 'element', (node) => {\n if (node.tagName !== 'code') return;\n if (hasChartLanguage(node.properties.className)) return;\n\n const highlightLines = getHighlightLines(node.properties.dataCodeLineHighlights);\n delete node.properties.dataCodeLineHighlights;\n const showLineNumbers = getShowLineNumbers(node.properties.dataCodeLineNumbers);\n delete node.properties.dataCodeLineNumbers;\n if (highlightLines.size === 0 && !showLineNumbers) return;\n\n if (showLineNumbers) {\n const classNames = ensureClassNameList(node.properties.className);\n if (!classNames.includes(CODE_LINE_NUMBERED_CLASS)) {\n classNames.push(CODE_LINE_NUMBERED_CLASS);\n }\n node.properties.className = classNames;\n }\n\n const splitLines = splitCodeChildrenIntoLines(node.children);\n const lastLine = splitLines[splitLines.length - 1];\n const hasTrailingNewline = splitLines.length > 0 && !!lastLine && isEmptyLine(lastLine);\n const contentLines = hasTrailingNewline ? splitLines.slice(0, -1) : splitLines;\n\n const children: ElementContent[] = [];\n for (let i = 0; i < contentLines.length; i += 1) {\n const lineNumber = i + 1;\n const className = highlightLines.has(lineNumber)\n ? [CODE_LINE_CLASS, CODE_LINE_HIGHLIGHTED_CLASS]\n : [CODE_LINE_CLASS];\n const lineChildren: ElementContent[] = [];\n if (showLineNumbers) {\n lineChildren.push({\n type: 'element',\n tagName: 'span',\n properties: { className: [CODE_LINE_NUMBER_CLASS] },\n children: [{ type: 'text', value: String(lineNumber) }],\n });\n }\n lineChildren.push(...(contentLines[i] ?? []));\n const lineSpan: Element = {\n type: 'element',\n tagName: 'span',\n properties: { className },\n children: lineChildren,\n };\n children.push(lineSpan);\n\n if (i < contentLines.length - 1 || hasTrailingNewline) {\n const newline: Text = { type: 'text', value: '\\n' };\n children.push(newline);\n }\n }\n\n node.children = children;\n });\n };\n};\n\nexport default rehypeCodeLineHighlights;\n","/** Supported `language-chart-<type>` fence identifiers for chart placeholder blocks. */\nexport const CHART_BLOCK_TYPES = [\n 'line',\n 'bar',\n 'radar',\n 'doughnut',\n 'pie',\n 'polarArea',\n 'bubble',\n 'scatter',\n] as const;\n\n/** Lookup set for fast chart type membership checks. */\nexport const CHART_BLOCK_TYPE_SET: ReadonlySet<string> = new Set(CHART_BLOCK_TYPES);\n","import { toText } from 'hast-util-to-text';\nimport type { Element, Root } from 'hast';\nimport { visit } from 'unist-util-visit';\nimport type { Plugin } from 'unified';\nimport { CHART_BLOCK_TYPE_SET } from './chartTypes.js';\nimport type { DiagnosticEmitter } from './diagnostics.js';\n\nconst LANG_PREFIX = 'language-chart-';\n\nfunction chartTypeFromClassName(className: unknown): string | undefined {\n const list = Array.isArray(className)\n ? className\n : typeof className === 'string'\n ? [className]\n : [];\n for (const c of list) {\n if (typeof c === 'string' && c.startsWith(LANG_PREFIX)) {\n return c.slice(LANG_PREFIX.length);\n }\n }\n return undefined;\n}\n\n/**\n * Turns ` ```chart-<type> ` fenced JSON into a mount placeholder `div`.\n * Invalid JSON leaves the original `<pre><code>` unchanged.\n */\nconst rehypeChartBlocks: Plugin<\n [{ emitDiagnostic?: DiagnosticEmitter }?],\n Root\n> = function rehypeChartBlocks(options) {\n const emitDiagnostic = options?.emitDiagnostic;\n return (tree): undefined => {\n visit(tree, 'element', (node, index, parent) => {\n if (node.tagName !== 'pre') return;\n if (!parent || typeof index !== 'number') return;\n const code = node.children[0];\n if (!code || code.type !== 'element' || code.tagName !== 'code') return;\n\n const chartType = chartTypeFromClassName(code.properties.className);\n if (!chartType || !CHART_BLOCK_TYPE_SET.has(chartType)) return;\n\n const raw = toText(code, { whitespace: 'pre' }).trim();\n try {\n const parsed: unknown = JSON.parse(raw);\n const jsonStr = JSON.stringify(parsed);\n const div: Element = {\n type: 'element',\n tagName: 'div',\n properties: {\n className: ['chart-mount'],\n dataChart: chartType,\n dataChartData: jsonStr,\n },\n children: [],\n };\n parent.children[index] = div;\n } catch {\n emitDiagnostic?.({\n code: 'chart.invalid_json',\n message: `Chart JSON could not be parsed for type \"${chartType}\".`,\n severity: 'warning',\n source: 'chart',\n });\n /* keep original pre/code */\n }\n });\n };\n};\n\nexport default rehypeChartBlocks;\n","import type { Element, Root } from 'hast';\nimport { visit } from 'unist-util-visit';\nimport type { DiagnosticEmitter } from './diagnostics.js';\n\ntype ManifestEntry = { url: string };\n\ntype RehypeCdnImagesOptions = {\n kind?: string;\n slug?: string;\n manifest?: {\n map?: Record<string, ManifestEntry>;\n remote?: Record<string, ManifestEntry>;\n };\n emitDiagnostic?: DiagnosticEmitter;\n};\n\nconst REMOTE_SRC_PATTERN = /^(https?:\\/\\/|data:|blob:)/;\n\nfunction getClassList(className: unknown): string[] {\n if (Array.isArray(className)) {\n return className.filter((value): value is string => typeof value === 'string');\n }\n if (typeof className === 'string') {\n return [className];\n }\n return [];\n}\n\nfunction ensureInlineClass(node: Element): void {\n const classes = getClassList(node.properties.className);\n if (!classes.includes('markdown-inline-img')) {\n classes.push('markdown-inline-img');\n }\n node.properties.className = classes;\n}\n\n/**\n * Rehype plugin that annotates image classes and rewrites image URLs via\n * optional manifest maps.\n */\nexport default function rehypeCdnImages(options?: RehypeCdnImagesOptions) {\n const kind = options?.kind;\n const slug = options?.slug;\n const map = options?.manifest?.map;\n const remote = options?.manifest?.remote;\n const emitDiagnostic = options?.emitDiagnostic;\n\n return (tree: Root): undefined => {\n visit(tree, 'element', (node) => {\n if (node.tagName !== 'img') return;\n\n ensureInlineClass(node);\n\n if (!kind || !slug) return;\n\n const src = node.properties.src;\n if (typeof src !== 'string') return;\n\n if (REMOTE_SRC_PATTERN.test(src)) {\n const nextSrc = remote?.[src]?.url;\n if (nextSrc) node.properties.src = nextSrc;\n return;\n }\n\n if (src.startsWith('/')) return;\n\n const cleanPath = src.replace(/^\\.\\/+/, '');\n const key = `${kind}/${slug}/${cleanPath}`;\n const nextSrc = map?.[key]?.url;\n if (nextSrc) {\n node.properties.src = nextSrc;\n } else {\n emitDiagnostic?.({\n code: 'images.manifest_miss',\n message: `No manifest entry found for \"${key}\".`,\n severity: 'warning',\n source: 'images',\n });\n }\n });\n };\n}\n","import type { Heading, Root } from 'mdast';\nimport { visit } from 'unist-util-visit';\n\nconst TRAILING_ID = /\\s+\\{#([\\w-]+)\\}\\s*$/;\n\n/**\n * Remark plugin: strips ` {#custom-id}` from heading text and sets `hProperties.id`\n * so remark-rehype puts `id` on the heading in hast before `rehype-sanitize`.\n * `rehype-slug` runs after sanitize and only fills in missing ids, so it does not\n * overwrite these (see `!node.properties.id` in rehype-slug).\n */\nexport function remarkHeadingIds(): (tree: Root) => undefined {\n return function (tree: Root): undefined {\n visit(tree, 'heading', (node: Heading) => {\n const last = node.children[node.children.length - 1];\n if (!last || last.type !== 'text') return;\n\n const match = TRAILING_ID.exec(last.value);\n if (!match?.[1]) return;\n\n if (!node.data) node.data = {};\n if (!node.data.hProperties) node.data.hProperties = {};\n const id = match[1];\n const data = node.data as typeof node.data & {\n id?: string;\n hProperties: Record<string, string | undefined>;\n };\n data.id = id;\n data.hProperties.id = id;\n data.hProperties.dataHeadingCustomId = 'true';\n\n last.value = last.value.slice(0, match.index).replace(/\\s+$/, '');\n });\n };\n}\n","import type { BlockContent, Root, RootContent } from 'mdast';\nimport { SKIP, visit } from 'unist-util-visit';\n\nconst SUPPORTED_CALLOUT_TYPES = [\n 'note',\n 'tip',\n 'warning',\n 'info',\n 'success',\n 'danger',\n 'error',\n 'caution',\n 'important',\n] as const;\ntype SupportedCalloutType = (typeof SUPPORTED_CALLOUT_TYPES)[number];\n\nconst DEFAULT_TITLES: Record<SupportedCalloutType, string> = {\n note: 'Note',\n tip: 'Tip',\n warning: 'Warning',\n info: 'Info',\n success: 'Success',\n danger: 'Danger',\n error: 'Error',\n caution: 'Caution',\n important: 'Important',\n};\n\nfunction isSupportedCalloutType(value: string): value is SupportedCalloutType {\n return (SUPPORTED_CALLOUT_TYPES as readonly string[]).includes(value);\n}\n\nfunction createMarkerParagraph(value: string): RootContent {\n return {\n type: 'paragraph',\n children: [{ type: 'text', value }],\n };\n}\n\nfunction normalizeWhitespace(value: string): string {\n return value.replace(/\\s+/g, ' ').trim();\n}\n\nfunction createTitleNode(title: string): BlockContent {\n return {\n type: 'paragraph',\n data: {\n hName: 'div',\n hProperties: {\n className: ['callout-title'],\n },\n },\n children: [{ type: 'text', value: title }],\n };\n}\n\nfunction toPlainMarkdownNodes(name: string, label: string | null | undefined, children: RootContent[]): RootContent[] {\n const openMarker = label ? `:::${name}[${label}]` : `:::${name}`;\n return [createMarkerParagraph(openMarker), ...children, createMarkerParagraph(':::')];\n}\n\nfunction extractDirectiveLabel(children: BlockContent[]): { label: string | null; bodyChildren: BlockContent[] } {\n const first = children[0];\n if (!first || first.type !== 'paragraph') {\n return { label: null, bodyChildren: children };\n }\n\n const hasDirectiveLabelFlag = (first.data as { directiveLabel?: boolean } | undefined)?.directiveLabel === true;\n if (!hasDirectiveLabelFlag) {\n return { label: null, bodyChildren: children };\n }\n\n const label = first.children\n .map((child) => (child.type === 'text' ? child.value : ''))\n .join('');\n const normalizedLabel = normalizeWhitespace(label);\n\n return {\n label: normalizedLabel || null,\n bodyChildren: children.slice(1),\n };\n}\n\ntype DirectiveNode = RootContent & {\n type: 'containerDirective';\n name: string;\n data?: {\n hName?: string;\n hProperties?: Record<string, unknown>;\n };\n children: BlockContent[];\n};\n\n/**\n * Maps supported :::type directives to stable callout HTML.\n */\nexport function remarkCallouts() {\n return (tree: Root): void => {\n visit(tree, 'containerDirective', (node, index, parent) => {\n if (index === undefined || !parent) {\n return;\n }\n\n const directive = node as DirectiveNode;\n const name = directive.name;\n const { label, bodyChildren } = extractDirectiveLabel(directive.children);\n\n if (isSupportedCalloutType(name)) {\n const title = label ?? DEFAULT_TITLES[name];\n directive.children = [createTitleNode(title), ...bodyChildren];\n directive.data = {\n ...(directive.data ?? {}),\n hName: 'div',\n hProperties: {\n ...(directive.data?.hProperties ?? {}),\n className: ['callout', `callout-${name}`],\n },\n };\n return;\n }\n\n const replacement = toPlainMarkdownNodes(name, label, bodyChildren);\n parent.children.splice(index, 1, ...replacement);\n return [SKIP, index + replacement.length];\n });\n };\n}\n","import type { Code, Root } from 'mdast';\nimport { visit } from 'unist-util-visit';\nimport type { Plugin } from 'unified';\n\nconst CHART_LANGUAGE_PREFIX = 'chart-';\nconst TITLE_META_PATTERN = /(?:^|\\s)title=\"([^\"]*)\"(?:\\s|$)/;\nconst LINE_HIGHLIGHT_PATTERN = /\\{([^}]*)\\}/;\nconst LINE_NUMBERS_PATTERN = /(?:^|\\s)(?:showLineNumbers|lineNumbers)(?:\\s|$)/;\nconst COPY_BUTTON_PATTERN = /(?:^|\\s)(?:showCopyButton|copyButton)(?:\\s|$)/;\n\nfunction getCodeBlockTitle(meta: unknown): string | undefined {\n if (typeof meta !== 'string') {\n return undefined;\n }\n const match = TITLE_META_PATTERN.exec(meta);\n if (!match) {\n return undefined;\n }\n return match[1];\n}\n\nfunction getCodeBlockHighlightLines(meta: unknown): number[] {\n if (typeof meta !== 'string') {\n return [];\n }\n const match = LINE_HIGHLIGHT_PATTERN.exec(meta);\n const raw = match?.[1];\n if (!raw) {\n return [];\n }\n\n const highlights = new Set<number>();\n const fragments = raw.split(',');\n for (const fragment of fragments) {\n const value = fragment.trim();\n if (/^\\d+$/.test(value)) {\n const line = Number(value);\n if (line > 0) {\n highlights.add(line);\n }\n continue;\n }\n\n const rangeMatch = /^(\\d+)-(\\d+)$/.exec(value);\n if (!rangeMatch) {\n continue;\n }\n\n const start = Number(rangeMatch[1]);\n const end = Number(rangeMatch[2]);\n if (start <= 0 || end <= 0 || start > end) {\n continue;\n }\n for (let line = start; line <= end; line += 1) {\n highlights.add(line);\n }\n }\n\n return Array.from(highlights).sort((a, b) => a - b);\n}\n\nfunction hasCodeBlockLineNumbers(meta: unknown): boolean {\n return typeof meta === 'string' && LINE_NUMBERS_PATTERN.test(meta);\n}\n\nfunction hasCodeBlockCopyButton(meta: unknown): boolean {\n return typeof meta === 'string' && COPY_BUTTON_PATTERN.test(meta);\n}\n\n/**\n * Extracts supported fenced code metadata and stores it on hProperties.\n */\nexport const remarkCodeBlockTitles: Plugin<[], Root> = function remarkCodeBlockTitles() {\n return (tree): undefined => {\n visit(tree, 'code', (node: Code) => {\n if (typeof node.lang === 'string' && node.lang.startsWith(CHART_LANGUAGE_PREFIX)) {\n return;\n }\n\n const title = getCodeBlockTitle(node.meta);\n const highlights = getCodeBlockHighlightLines(node.meta);\n const hasLineNumbers = hasCodeBlockLineNumbers(node.meta);\n const hasCopyButton = hasCodeBlockCopyButton(node.meta);\n if (title === undefined && highlights.length === 0 && !hasLineNumbers && !hasCopyButton) {\n return;\n }\n\n node.data ??= {};\n node.data.hProperties ??= {};\n\n if (title !== undefined) {\n node.data.hProperties.dataCodeBlockTitle = title;\n }\n if (highlights.length > 0) {\n node.data.hProperties.dataCodeLineHighlights = highlights;\n }\n if (hasLineNumbers) {\n node.data.hProperties.dataCodeLineNumbers = true;\n }\n if (hasCopyButton) {\n node.data.hProperties.dataCodeCopyButton = true;\n }\n });\n };\n};\n","import type { Schema } from 'hast-util-sanitize';\nimport { defaultSchema } from 'rehype-sanitize';\nimport { CHART_BLOCK_TYPES } from './chartTypes.js';\n\n/**\n * Extends the GitHub-style default sanitizer for this pipeline:\n *\n * - **`className` on `*`** — highlight.js and KaTeX mark up nested spans (and raw HTML\n * may set classes on other allowed tags). The base schema does not allow\n * arbitrary classes without this.\n * - **`style` on `span` only** — KaTeX `output: 'html'` uses inline `style` on spans for\n * layout; samples from KaTeX do not attach `style` to other tag names. Allowing\n * `style` on every element would broaden XSS surface for author-controlled raw HTML.\n * - **Chart placeholders** — `div.chart-mount` with `dataChart` / `dataChartData` (narrow\n * allowed chart type strings; data payload is the JSON string).\n *\n * Scripts remain stripped (`strip: ['script']`).\n */\nconst baseAttrs = defaultSchema.attributes ?? {};\nconst baseStar = baseAttrs['*'] ?? [];\nconst baseSpan = baseAttrs.span ?? [];\nconst baseDiv = baseAttrs.div ?? [];\nconst baseCode = baseAttrs.code ?? [];\nconst baseButton = baseAttrs.button ?? [];\nconst baseH1 = baseAttrs.h1 ?? [];\nconst baseH2 = baseAttrs.h2 ?? [];\nconst baseH3 = baseAttrs.h3 ?? [];\nconst baseH4 = baseAttrs.h4 ?? [];\nconst baseH5 = baseAttrs.h5 ?? [];\nconst baseH6 = baseAttrs.h6 ?? [];\nconst baseTags = defaultSchema.tagNames ?? [];\nconst calloutClassNames = [\n 'callout',\n 'callout-note',\n 'callout-tip',\n 'callout-warning',\n 'callout-info',\n 'callout-success',\n 'callout-danger',\n 'callout-error',\n 'callout-caution',\n 'callout-important',\n 'callout-title',\n 'chart-mount',\n 'code-block',\n 'code-block-title',\n 'code-block-copyable',\n] as const;\nconst buttonClassNames = ['code-block-copy-button'] as const;\n\nexport const markdownSanitizeSchema: Schema = {\n ...defaultSchema,\n tagNames: [...baseTags, 'button'],\n attributes: {\n ...baseAttrs,\n '*': [...baseStar, 'className'],\n span: [...baseSpan, 'style'],\n code: [...baseCode, 'className', 'dataCodeCopyTarget', 'dataCodeLineHighlights', 'dataCodeLineNumbers'],\n button: [...baseButton, ['className', ...buttonClassNames], 'type', 'dataCodeCopy', 'dataCodeCopyTarget'],\n h1: [...baseH1, 'dataHeadingCustomId'],\n h2: [...baseH2, 'dataHeadingCustomId'],\n h3: [...baseH3, 'dataHeadingCustomId'],\n h4: [...baseH4, 'dataHeadingCustomId'],\n h5: [...baseH5, 'dataHeadingCustomId'],\n h6: [...baseH6, 'dataHeadingCustomId'],\n div: [\n ...baseDiv,\n ['className', ...calloutClassNames],\n ['dataChart', ...CHART_BLOCK_TYPES],\n 'dataChartData',\n ],\n },\n};\n\nconst svgTags = [\n 'svg',\n 'g',\n 'path',\n 'marker',\n 'rect',\n 'circle',\n 'line',\n 'polygon',\n 'text',\n 'tspan',\n 'style',\n 'foreignObject',\n 'defs',\n 'symbol',\n] as const;\n\nconst svgSharedAttributes = [\n 'style',\n 'transform',\n 'fill',\n 'stroke',\n 'strokeWidth',\n 'strokeDasharray',\n 'id',\n 'className',\n] as const;\n\n/**\n * Mermaid-capable sanitizer schema for the Node-only rendering path.\n * It extends the browser-safe schema with a narrow SVG allowlist used by\n * inline Mermaid output.\n */\nexport const schemaWithSvg: Schema = {\n ...markdownSanitizeSchema,\n tagNames: [...(markdownSanitizeSchema.tagNames ?? []), ...svgTags],\n attributes: {\n ...(markdownSanitizeSchema.attributes ?? {}),\n div: [\n ...baseDiv,\n 'style',\n 'xmlns',\n ['className', ...calloutClassNames],\n ['dataChart', ...CHART_BLOCK_TYPES],\n 'dataChartData',\n ],\n svg: [\n ...svgSharedAttributes,\n 'ariaRoleDescription',\n 'role',\n 'viewBox',\n 'width',\n 'xmlns',\n ],\n g: [\n ...svgSharedAttributes,\n 'dataId',\n 'dataNode',\n ],\n path: [...svgSharedAttributes, 'd', 'markerEnd'],\n marker: [\n ...svgSharedAttributes,\n 'markerHeight',\n 'markerUnits',\n 'markerWidth',\n 'orient',\n 'refX',\n 'refY',\n 'viewBox',\n ],\n rect: [...svgSharedAttributes, 'height', 'rx', 'ry', 'width', 'x', 'y', 'name'],\n circle: [...svgSharedAttributes, 'cx', 'cy', 'r'],\n line: [...svgSharedAttributes, 'markerEnd', 'x1', 'x2', 'y1', 'y2'],\n polygon: [...svgSharedAttributes, 'points'],\n text: [\n ...svgSharedAttributes,\n 'alignmentBaseline',\n 'dominantBaseline',\n 'dy',\n 'textAnchor',\n 'x',\n 'y',\n ],\n tspan: [...svgSharedAttributes, 'dy', 'x'],\n foreignObject: ['height', 'width'],\n symbol: ['clipRule', 'fillRule', 'height', 'id', 'width'],\n defs: [],\n style: [],\n },\n};\n","import rehypeAutolinkHeadings from 'rehype-autolink-headings';\nimport rehypeHighlight from 'rehype-highlight';\nimport rehypeKatex from 'rehype-katex';\nimport rehypeCodeBlockTitles from './rehypeCodeBlockTitles.js';\nimport rehypeCodeLineHighlights from './rehypeCodeLineHighlights.js';\nimport rehypeRaw from 'rehype-raw';\nimport rehypeChartBlocksInternal from './rehypeChartBlocksInternal.js';\nimport rehypeCdnImagesInternal from './rehypeCdnImagesInternal.js';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeSlug from 'rehype-slug';\nimport rehypeStringify from 'rehype-stringify';\nimport remarkDirective from 'remark-directive';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport type { Root as HastRoot } from 'hast';\nimport { visit } from 'unist-util-visit';\nimport type { Root as MdastRoot } from 'mdast';\nimport type { Processor } from 'unified';\nimport { unified } from 'unified';\nimport type { RenderMarkdownOptions } from '../types.js';\nimport { remarkHeadingIds } from './headingIdsRemark.js';\nimport { remarkCallouts } from './remarkCallouts.js';\nimport { remarkCodeBlockTitles } from './remarkCodeBlockTitles.js';\nimport type { DiagnosticEmitter } from './diagnostics.js';\nimport { markdownSanitizeSchema } from './sanitizeSchema.js';\n\n/** Optional pipeline stages for {@link Featherdown}; omit for legacy all-on behavior. */\nexport type MarkdownProcessorFeatureGates = {\n math: boolean;\n code: boolean;\n codeHighlighting: boolean;\n charts: boolean;\n sanitize: boolean;\n};\n\ntype InternalOptions = RenderMarkdownOptions & {\n emitDiagnostic?: DiagnosticEmitter;\n preserveHeadingCustomIdMarker?: boolean;\n features?: MarkdownProcessorFeatureGates;\n};\n\nfunction rehypeStripHeadingCustomIdMarker() {\n return (tree: HastRoot): undefined => {\n visit(tree, 'element', (node) => {\n if (!/^h[1-6]$/.test(node.tagName)) {\n return;\n }\n delete node.properties.dataHeadingCustomId;\n });\n };\n}\n\n/**\n * Build the default browser-safe unified processor used by public APIs.\n *\n * Internal helper that wires remark/rehype plugins for math, highlighting,\n * sanitization, heading ids, chart placeholders, and image rewriting.\n */\nexport function createMarkdownProcessorInternal(\n options?: InternalOptions,\n): Processor<MdastRoot, MdastRoot, HastRoot> {\n const gates: MarkdownProcessorFeatureGates = options?.features ?? {\n math: true,\n code: true,\n codeHighlighting: true,\n charts: true,\n sanitize: true,\n };\n\n const processor = unified().use(remarkParse).use(remarkGfm).use(remarkDirective);\n\n if (gates.math) {\n processor.use(remarkMath);\n }\n\n processor.use(remarkHeadingIds).use(remarkCallouts);\n\n if (gates.code) {\n processor.use(remarkCodeBlockTitles);\n }\n\n processor.use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw);\n\n if (gates.charts) {\n if (options?.emitDiagnostic) {\n processor.use(rehypeChartBlocksInternal, { emitDiagnostic: options.emitDiagnostic });\n } else {\n processor.use(rehypeChartBlocksInternal);\n }\n }\n\n if (gates.code) {\n processor.use(rehypeCodeBlockTitles);\n }\n\n if (gates.math) {\n processor.use(rehypeKatex, { output: 'html' });\n }\n\n if (gates.sanitize) {\n processor.use(rehypeSanitize, markdownSanitizeSchema);\n }\n\n processor.use(rehypeSlug).use(rehypeAutolinkHeadings, { behavior: 'wrap' });\n\n if (gates.code && gates.codeHighlighting) {\n processor.use(rehypeHighlight).use(rehypeCodeLineHighlights);\n }\n\n if (!options?.preserveHeadingCustomIdMarker) {\n processor.use(rehypeStripHeadingCustomIdMarker);\n }\n\n processor.use(rehypeCdnImagesInternal, options).use(rehypeStringify);\n\n return processor as unknown as Processor<MdastRoot, MdastRoot, HastRoot>;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { R as RenderDiagnostic, F as FeatherdownResult } from './types-Blk9BrZ4.js';
2
+
3
+ /**
4
+ * Thrown when {@link FeatherdownOptions.diagnostics} is `"strict"` and the
5
+ * render pipeline produced one or more {@link RenderDiagnostic} entries.
6
+ */
7
+ declare class FeatherdownDiagnosticsError extends Error {
8
+ readonly name = "FeatherdownDiagnosticsError";
9
+ readonly diagnostics: RenderDiagnostic[];
10
+ /**
11
+ * Full parse result as built before the strict check, including `html` and
12
+ * the same `diagnostics` array as {@link FeatherdownDiagnosticsError.diagnostics}.
13
+ * Omitted when the error is constructed without a result (internal use only).
14
+ */
15
+ readonly result: FeatherdownResult | undefined;
16
+ constructor(diagnostics: RenderDiagnostic[], result?: FeatherdownResult);
17
+ }
18
+
19
+ export { FeatherdownDiagnosticsError as F };
package/dist/index.d.ts CHANGED
@@ -1,45 +1,98 @@
1
- import { R as RenderDiagnostic, a as RenderMarkdownOptions } from './types-DlRranpy.js';
2
- import { Root as Root$1 } from 'hast';
3
- import { Root } from 'mdast';
4
- import { Processor, Plugin } from 'unified';
1
+ import { a as FeatherdownOptions, c as FeatherdownParseOptions, F as FeatherdownResult, b as RenderMarkdownOptions, R as RenderDiagnostic, d as RenderMarkdownDocumentResult } from './types-Blk9BrZ4.js';
2
+ export { e as FeatherdownCodeOptions, f as FeatherdownHeadingOptions, g as FeatherdownMathOptions, h as FeatherdownMetadata, i as FeatherdownPublishingOptions, H as HeadingMetadata, T as TocItem } from './types-Blk9BrZ4.js';
3
+ export { F as FeatherdownDiagnosticsError } from './featherdownDiagnosticsError-CE9gG3W7.js';
4
+ export { createMarkdownProcessor, rehypeCdnImages, rehypeChartBlocks } from './advanced.js';
5
+ import 'hast';
6
+ import 'mdast';
7
+ import 'unified';
5
8
 
6
9
  /**
7
- * Stable identifier for this library. Intended for diagnostics and smoke tests.
10
+ * Primary user-facing API for rendering Markdown with publishing metadata.
11
+ *
12
+ * Prefer this class over legacy helpers such as `renderMarkdownDocument` or
13
+ * `renderMarkdownToHtml`; those remain for compatibility.
8
14
  */
9
- declare function libraryId(): string;
10
-
11
- declare function parseMarkdownFile(raw: string): {
12
- frontMatter: Record<string, unknown>;
13
- content: string;
14
- };
15
-
16
- type DiagnosticEmitter = (d: RenderDiagnostic) => void;
17
-
18
- type InternalOptions = RenderMarkdownOptions & {
19
- emitDiagnostic?: DiagnosticEmitter;
20
- };
21
- declare function createMarkdownProcessorInternal(options?: InternalOptions): Processor<Root, Root, Root$1>;
22
-
23
- declare function createMarkdownProcessor(options?: RenderMarkdownOptions): ReturnType<typeof createMarkdownProcessorInternal>;
15
+ declare class Featherdown {
16
+ private readonly defaultOptions;
17
+ constructor(options?: FeatherdownOptions);
18
+ /**
19
+ * Render Markdown to HTML and document metadata. Constructor options are merged
20
+ * with per-call options; per-call values win. Nested option groups use a
21
+ * shallow one-level merge.
22
+ */
23
+ parse(markdown: string, parseOptions?: FeatherdownParseOptions): Promise<FeatherdownResult>;
24
+ }
24
25
 
25
26
  /**
26
- * Replaces supported `chart-…` fenced JSON blocks with a mount placeholder.
27
- * Invalid JSON leaves the original `<pre><code>` unchanged.
27
+ * Utility entrypoint for package identity checks.
28
+ *
29
+ * Exports a stable library identifier used in diagnostics and smoke tests.
28
30
  */
29
- declare const rehypeChartBlocks: Plugin<[], Root$1>;
30
-
31
- type RehypeCdnImagesOptions = RenderMarkdownOptions;
32
31
  /**
33
- * Adds `markdown-inline-img` to all images and optionally rewrites `src` using
34
- * caller-provided manifest data.
32
+ * Stable identifier for this library. Intended for diagnostics and smoke tests.
35
33
  */
36
- declare const rehypeCdnImages: Plugin<[RehypeCdnImagesOptions?], Root$1>;
34
+ declare function libraryId(): string;
37
35
 
36
+ /**
37
+ * Render Markdown to sanitized HTML and collect non-fatal diagnostics.
38
+ *
39
+ * @deprecated Prefer `new Featherdown().parse(markdown)` for new code.
40
+ * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.
41
+ * This helper remains available for compatibility.
42
+ *
43
+ * This entrypoint is useful when callers want warning metadata in addition to
44
+ * the final HTML string.
45
+ */
38
46
  declare function renderMarkdown(markdown: string, options?: RenderMarkdownOptions): Promise<{
39
47
  html: string;
40
48
  diagnostics: RenderDiagnostic[];
41
49
  }>;
42
50
 
51
+ /**
52
+ * Render Markdown to sanitized HTML and extract publishing metadata from the
53
+ * final rendered document structure.
54
+ *
55
+ * @deprecated Prefer `new Featherdown().parse(markdown)` for new code.
56
+ * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.
57
+ * This helper remains available for compatibility.
58
+ */
59
+ declare function renderMarkdownDocument(markdown: string, options?: RenderMarkdownOptions): Promise<RenderMarkdownDocumentResult>;
60
+
61
+ /**
62
+ * Render Markdown to sanitized HTML with featherdown defaults.
63
+ *
64
+ * @deprecated Prefer `(await new Featherdown().parse(markdown)).html` for new code.
65
+ * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.
66
+ * This helper remains available for compatibility.
67
+ *
68
+ * This is the simplest public API for callers that only need HTML output and
69
+ * do not need diagnostics.
70
+ */
43
71
  declare function renderMarkdownToHtml(markdown: string, options?: RenderMarkdownOptions): Promise<string>;
44
72
 
45
- export { RenderDiagnostic, RenderMarkdownOptions, createMarkdownProcessor, libraryId, parseMarkdownFile, rehypeCdnImages, rehypeChartBlocks, renderMarkdown, renderMarkdownToHtml };
73
+ /**
74
+ * Parsed result from a Markdown file with optional front matter.
75
+ */
76
+ type ParsedMarkdownFile = {
77
+ /**
78
+ * YAML front matter object. Empty when front matter is missing.
79
+ */
80
+ frontMatter: Record<string, unknown>;
81
+ /**
82
+ * Markdown body content after the front matter fence.
83
+ */
84
+ content: string;
85
+ };
86
+ /**
87
+ * Reads optional YAML front matter and returns metadata plus Markdown body.
88
+ *
89
+ * @deprecated Prefer `new Featherdown({ frontmatter: "auto" }).parse(markdown)` for new code.
90
+ * That path returns a full `FeatherdownResult`; this function uses a separate strict front-matter-only contract.
91
+ * This strict front matter utility remains available for compatibility.
92
+ *
93
+ * Throws when front matter exists but is invalid YAML, or when the root value
94
+ * is not a mapping object.
95
+ */
96
+ declare function parseMarkdownFile(raw: string): ParsedMarkdownFile;
97
+
98
+ export { Featherdown, FeatherdownOptions, FeatherdownParseOptions, FeatherdownResult, RenderDiagnostic, RenderMarkdownDocumentResult, RenderMarkdownOptions, libraryId, parseMarkdownFile, renderMarkdown, renderMarkdownDocument, renderMarkdownToHtml };
package/dist/index.js CHANGED
@@ -1,99 +1,36 @@
1
- import { rehypeCdnImages, rehypeChartBlocks_default, remarkHeadingIds, markdownSanitizeSchema } from './chunk-CVZY5VWM.js';
2
- import yaml from 'js-yaml';
3
- import rehypeAutolinkHeadings from 'rehype-autolink-headings';
4
- import rehypeHighlight from 'rehype-highlight';
5
- import rehypeKatex from 'rehype-katex';
6
- import rehypeRaw from 'rehype-raw';
7
- import rehypeSanitize from 'rehype-sanitize';
8
- import rehypeSlug from 'rehype-slug';
9
- import rehypeStringify from 'rehype-stringify';
10
- import remarkGfm from 'remark-gfm';
11
- import remarkMath from 'remark-math';
12
- import remarkParse from 'remark-parse';
13
- import remarkRehype from 'remark-rehype';
14
- import { unified } from 'unified';
1
+ export { createMarkdownProcessor, rehypeCdnImages, rehypeChartBlocks } from './chunk-DNLCIOR6.js';
2
+ import { renderMarkdownDocumentInternal, extractFrontMatterStrict } from './chunk-CWUDY7YI.js';
3
+ export { Featherdown, FeatherdownDiagnosticsError } from './chunk-CWUDY7YI.js';
4
+ import './chunk-YKLQHPRB.js';
15
5
 
16
6
  // src/libraryId.ts
17
7
  function libraryId() {
18
8
  return "featherdown";
19
9
  }
20
- function parseMarkdownFile(raw) {
21
- const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(raw);
22
- if (!raw.startsWith("---") || !match) {
23
- return { frontMatter: {}, content: raw };
24
- }
25
- const yamlSource = match[1] ?? "";
26
- const content = raw.slice(match[0].length);
27
- try {
28
- const loaded = yaml.load(yamlSource);
29
- if (loaded === void 0 || loaded === null) {
30
- return { frontMatter: {}, content };
31
- }
32
- if (typeof loaded !== "object" || Array.isArray(loaded)) {
33
- throw new Error(
34
- "Front matter root must be a YAML mapping (object), not a list or scalar."
35
- );
36
- }
37
- return { frontMatter: loaded, content };
38
- } catch (e) {
39
- if (e instanceof Error && e.message.startsWith("Front matter")) {
40
- throw e;
41
- }
42
- const detail = e instanceof Error ? e.message : String(e);
43
- throw new Error(`Front matter YAML could not be parsed: ${detail}`);
44
- }
45
- }
46
- function createMarkdownProcessorInternal(options) {
47
- const processor = unified().use(remarkParse).use(remarkGfm).use(remarkMath).use(remarkHeadingIds).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeRaw);
48
- if (options?.emitDiagnostic) {
49
- processor.use(rehypeChartBlocks_default, { emitDiagnostic: options.emitDiagnostic });
50
- } else {
51
- processor.use(rehypeChartBlocks_default);
52
- }
53
- processor.use(rehypeKatex, { output: "html" }).use(rehypeSanitize, markdownSanitizeSchema).use(rehypeSlug).use(rehypeAutolinkHeadings, { behavior: "wrap" }).use(rehypeHighlight).use(rehypeCdnImages, options).use(rehypeStringify);
54
- return processor;
55
- }
56
-
57
- // src/createMarkdownProcessor.ts
58
- function createMarkdownProcessor(options) {
59
- return createMarkdownProcessorInternal(options);
60
- }
61
10
 
62
- // src/rehypeChartBlocks.ts
63
- var rehypeChartBlocks = rehypeChartBlocks_default;
64
-
65
- // src/rehypeCdnImages.ts
66
- var rehypeCdnImages2 = rehypeCdnImages;
67
-
68
- // src/internal/diagnostics.ts
69
- function createDiagnosticCollector() {
70
- const diagnostics = [];
71
- const emit = (d) => {
72
- diagnostics.push(d);
73
- };
74
- return {
75
- emit,
76
- diagnostics
77
- };
11
+ // src/renderMarkdownDocument.ts
12
+ async function renderMarkdownDocument(markdown, options) {
13
+ return renderMarkdownDocumentInternal(markdown, options);
78
14
  }
79
15
 
80
16
  // src/renderMarkdown.ts
81
17
  async function renderMarkdown(markdown, options) {
82
- const collector = createDiagnosticCollector();
83
- const processor = createMarkdownProcessorInternal({
84
- ...options,
85
- emitDiagnostic: collector.emit
86
- });
87
- const file = await processor.process(markdown);
88
- return { html: String(file), diagnostics: collector.diagnostics };
18
+ const result = await renderMarkdownDocument(markdown, options);
19
+ return { html: result.html, diagnostics: result.diagnostics };
89
20
  }
90
21
 
91
22
  // src/renderMarkdownToHtml.ts
92
23
  async function renderMarkdownToHtml(markdown, options) {
93
- const result = await renderMarkdown(markdown, options);
24
+ const result = await renderMarkdownDocument(markdown, options);
94
25
  return result.html;
95
26
  }
96
27
 
97
- export { createMarkdownProcessor, libraryId, parseMarkdownFile, rehypeCdnImages2 as rehypeCdnImages, rehypeChartBlocks, renderMarkdown, renderMarkdownToHtml };
28
+ // src/parseMarkdownFile.ts
29
+ function parseMarkdownFile(raw) {
30
+ const { body, frontmatter } = extractFrontMatterStrict(raw);
31
+ return { frontMatter: frontmatter, content: body };
32
+ }
33
+
34
+ export { libraryId, parseMarkdownFile, renderMarkdown, renderMarkdownDocument, renderMarkdownToHtml };
98
35
  //# sourceMappingURL=index.js.map
99
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/libraryId.ts","../src/parseMarkdownFile.ts","../src/internal/createMarkdownProcessorInternal.ts","../src/createMarkdownProcessor.ts","../src/rehypeChartBlocks.ts","../src/rehypeCdnImages.ts","../src/internal/diagnostics.ts","../src/renderMarkdown.ts","../src/renderMarkdownToHtml.ts"],"names":["rehypeCdnImages"],"mappings":";;;;;;;;;;;;;;;;AAGO,SAAS,SAAA,GAAoB;AAClC,EAAA,OAAO,aAAA;A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C4D;AAC5D,EAAA,MAAM,YAAY,yBAAA,EAA0B;AAC5C,EAAA,MAAM,YAAY,+BAAA,CAAgC;AAAA,IAChD,GAAG,OAAA;AAAA,IACH,gBAAgB,SAAA,CAAU;AAAA,GAC3B,CAAA;AACD,EAAA,MAAM,IAAA,GAAO,MAAM,SAAA,CAAU,OAAA,CAAQ,QAAQ,CAAA;AAC7C,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,CAAO,IAAI,CAAA,EAAG,WAAA,EAAa,UAAU,WAAA,EAAY;AAClE;;;ACZA,eAAsB,oBAAA,CACpB,UACA,OAAA,EACiB;AACjB,EAAA,MAAM,MAAA,GAAS,MAAM,cAAA,CAAe,QAAA,EAAU,OAAO,CAAA;AACrD,EAAA,OAAO,MAAA,CAAO,IAAA;AAChB","file":"index.js","sourcesContent":["/**\n * Stable identifier for this library. Intended for diagnostics and smoke tests.\n */\nexport function libraryId(): string {\n return 'featherdown';\n}\n","import yaml from 'js-yaml';\n\nexport function parseMarkdownFile(raw: string): {\n frontMatter: Record<string, unknown>;\n content: string;\n} {\n const match = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/.exec(raw);\n if (!raw.startsWith('---') || !match) {\n return { frontMatter: {}, content: raw };\n }\n\n const yamlSource = match[1] ?? '';\n const content = raw.slice(match[0].length);\n\n try {\n const loaded: unknown = yaml.load(yamlSource);\n if (loaded === undefined || loaded === null) {\n return { frontMatter: {}, content };\n }\n if (typeof loaded !== 'object' || Array.isArray(loaded)) {\n throw new Error(\n 'Front matter root must be a YAML mapping (object), not a list or scalar.',\n );\n }\n return { frontMatter: loaded as Record<string, unknown>, content };\n } catch (e) {\n if (e instanceof Error && e.message.startsWith('Front matter')) {\n throw e;\n }\n const detail = e instanceof Error ? e.message : String(e);\n throw new Error(`Front matter YAML could not be parsed: ${detail}`);\n }\n}\n","import rehypeAutolinkHeadings from 'rehype-autolink-headings';\nimport rehypeHighlight from 'rehype-highlight';\nimport rehypeKatex from 'rehype-katex';\nimport rehypeRaw from 'rehype-raw';\nimport rehypeChartBlocksInternal from './rehypeChartBlocksInternal.js';\nimport rehypeCdnImagesInternal from './rehypeCdnImagesInternal.js';\nimport rehypeSanitize from 'rehype-sanitize';\nimport rehypeSlug from 'rehype-slug';\nimport rehypeStringify from 'rehype-stringify';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport type { Root as HastRoot } from 'hast';\nimport type { Root as MdastRoot } from 'mdast';\nimport type { Processor } from 'unified';\nimport { unified } from 'unified';\nimport type { RenderMarkdownOptions } from '../types.js';\nimport { remarkHeadingIds } from './headingIdsRemark.js';\nimport type { DiagnosticEmitter } from './diagnostics.js';\nimport { markdownSanitizeSchema } from './sanitizeSchema.js';\n\ntype InternalOptions = RenderMarkdownOptions & {\n emitDiagnostic?: DiagnosticEmitter;\n};\n\nexport function createMarkdownProcessorInternal(\n options?: InternalOptions,\n): Processor<MdastRoot, MdastRoot, HastRoot> {\n const processor = unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(remarkMath)\n .use(remarkHeadingIds)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeRaw);\n\n if (options?.emitDiagnostic) {\n processor.use(rehypeChartBlocksInternal, { emitDiagnostic: options.emitDiagnostic });\n } else {\n processor.use(rehypeChartBlocksInternal);\n }\n\n processor\n .use(rehypeKatex, { output: 'html' })\n .use(rehypeSanitize, markdownSanitizeSchema)\n .use(rehypeSlug)\n .use(rehypeAutolinkHeadings, { behavior: 'wrap' })\n .use(rehypeHighlight)\n .use(rehypeCdnImagesInternal, options)\n .use(rehypeStringify);\n\n return processor;\n}\n\n","import type { RenderMarkdownOptions } from './types.js';\nimport { createMarkdownProcessorInternal } from './internal/createMarkdownProcessorInternal.js';\n\nexport function createMarkdownProcessor(\n options?: RenderMarkdownOptions,\n): ReturnType<typeof createMarkdownProcessorInternal> {\n return createMarkdownProcessorInternal(options);\n}\n\n","import type { Plugin } from 'unified';\nimport type { Root } from 'hast';\nimport rehypeChartBlocksInternal from './internal/rehypeChartBlocksInternal.js';\n\n/**\n * Replaces supported `chart-…` fenced JSON blocks with a mount placeholder.\n * Invalid JSON leaves the original `<pre><code>` unchanged.\n */\nexport const rehypeChartBlocks: Plugin<[], Root> =\n rehypeChartBlocksInternal as unknown as Plugin<[], Root>;\n\n","import type { Plugin } from 'unified';\nimport type { Root } from 'hast';\nimport type { RenderMarkdownOptions } from './types.js';\nimport rehypeCdnImagesInternal from './internal/rehypeCdnImagesInternal.js';\n\nexport type RehypeCdnImagesOptions = RenderMarkdownOptions;\n\n/**\n * Adds `markdown-inline-img` to all images and optionally rewrites `src` using\n * caller-provided manifest data.\n */\nexport const rehypeCdnImages: Plugin<[RehypeCdnImagesOptions?], Root> =\n rehypeCdnImagesInternal as unknown as Plugin<[RehypeCdnImagesOptions?], Root>;\n\n","import type { RenderDiagnostic } from '../types.js';\n\nexport type DiagnosticEmitter = (d: RenderDiagnostic) => void;\n\nexport function createDiagnosticCollector() {\n const diagnostics: RenderDiagnostic[] = [];\n const emit: DiagnosticEmitter = (d) => {\n diagnostics.push(d);\n };\n\n return {\n emit,\n diagnostics,\n };\n}\n\n","import { createMarkdownProcessorInternal } from './internal/createMarkdownProcessorInternal.js';\nimport { createDiagnosticCollector } from './internal/diagnostics.js';\nimport type { RenderDiagnostic, RenderMarkdownOptions } from './types.js';\n\nexport async function renderMarkdown(\n markdown: string,\n options?: RenderMarkdownOptions,\n): Promise<{ html: string; diagnostics: RenderDiagnostic[] }> {\n const collector = createDiagnosticCollector();\n const processor = createMarkdownProcessorInternal({\n ...options,\n emitDiagnostic: collector.emit,\n });\n const file = await processor.process(markdown);\n return { html: String(file), diagnostics: collector.diagnostics };\n}\n\n","import { renderMarkdown } from './renderMarkdown.js';\nimport type { RenderMarkdownOptions } from './types.js';\n\nexport async function renderMarkdownToHtml(\n markdown: string,\n options?: RenderMarkdownOptions,\n): Promise<string> {\n const result = await renderMarkdown(markdown, options);\n return result.html;\n}\n"]}
1
+ {"version":3,"sources":["../src/libraryId.ts","../src/renderMarkdownDocument.ts","../src/renderMarkdown.ts","../src/renderMarkdownToHtml.ts","../src/parseMarkdownFile.ts"],"names":[],"mappings":";;;;;;AASO,SAAS,SAAA,GAAoB;AAClC,EAAA,OAAO,aAAA;AACT;;;ACAA,eAAsB,sBAAA,CACpB,UACA,OAAA,EACuC;AACvC,EAAA,OAAO,8BAAA,CAA+B,UAAU,OAAO,CAAA;AACzD;;;ACHA,eAAsB,cAAA,CACpB,UACA,OAAA,EAC4D;AAC5D,EAAA,MAAM,MAAA,GAAS,MAAM,sBAAA,CAAuB,QAAA,EAAU,OAAO,CAAA;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,CAAO,IAAA,EAAM,WAAA,EAAa,OAAO,WAAA,EAAY;AAC9D;;;ACNA,eAAsB,oBAAA,CACpB,UACA,OAAA,EACiB;AACjB,EAAA,MAAM,MAAA,GAAS,MAAM,sBAAA,CAAuB,QAAA,EAAU,OAAO,CAAA;AAC7D,EAAA,OAAO,MAAA,CAAO,IAAA;AAChB;;;ACOO,SAAS,kBAAkB,GAAA,EAAiC;AACjE,EAAA,MAAM,EAAE,IAAA,EAAM,WAAA,EAAY,GAAI,yBAAyB,GAAG,CAAA;AAC1D,EAAA,OAAO,EAAE,WAAA,EAAa,WAAA,EAAa,OAAA,EAAS,IAAA,EAAK;AACnD","file":"index.js","sourcesContent":["/**\n * Utility entrypoint for package identity checks.\n *\n * Exports a stable library identifier used in diagnostics and smoke tests.\n */\n\n/**\n * Stable identifier for this library. Intended for diagnostics and smoke tests.\n */\nexport function libraryId(): string {\n return 'featherdown';\n}\n","import { renderMarkdownDocumentInternal } from './internal/renderMarkdownDocumentInternal.js';\nimport type { RenderMarkdownDocumentResult, RenderMarkdownOptions } from './types.js';\n\n/**\n * Render Markdown to sanitized HTML and extract publishing metadata from the\n * final rendered document structure.\n *\n * @deprecated Prefer `new Featherdown().parse(markdown)` for new code.\n * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.\n * This helper remains available for compatibility.\n */\nexport async function renderMarkdownDocument(\n markdown: string,\n options?: RenderMarkdownOptions,\n): Promise<RenderMarkdownDocumentResult> {\n return renderMarkdownDocumentInternal(markdown, options);\n}\n","import { renderMarkdownDocument } from './renderMarkdownDocument.js';\nimport type { RenderDiagnostic, RenderMarkdownOptions } from './types.js';\n\n/**\n * Render Markdown to sanitized HTML and collect non-fatal diagnostics.\n *\n * @deprecated Prefer `new Featherdown().parse(markdown)` for new code.\n * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.\n * This helper remains available for compatibility.\n *\n * This entrypoint is useful when callers want warning metadata in addition to\n * the final HTML string.\n */\nexport async function renderMarkdown(\n markdown: string,\n options?: RenderMarkdownOptions,\n): Promise<{ html: string; diagnostics: RenderDiagnostic[] }> {\n const result = await renderMarkdownDocument(markdown, options);\n return { html: result.html, diagnostics: result.diagnostics };\n}\n","import { renderMarkdownDocument } from './renderMarkdownDocument.js';\nimport type { RenderMarkdownOptions } from './types.js';\n\n/**\n * Render Markdown to sanitized HTML with featherdown defaults.\n *\n * @deprecated Prefer `(await new Featherdown().parse(markdown)).html` for new code.\n * This helper accepts `RenderMarkdownOptions` only—not full `FeatherdownOptions`.\n * This helper remains available for compatibility.\n *\n * This is the simplest public API for callers that only need HTML output and\n * do not need diagnostics.\n */\nexport async function renderMarkdownToHtml(\n markdown: string,\n options?: RenderMarkdownOptions,\n): Promise<string> {\n const result = await renderMarkdownDocument(markdown, options);\n return result.html;\n}\n","import { extractFrontMatterStrict } from './internal/parseFrontmatter.js';\n\n/**\n * Parsed result from a Markdown file with optional front matter.\n */\nexport type ParsedMarkdownFile = {\n /**\n * YAML front matter object. Empty when front matter is missing.\n */\n frontMatter: Record<string, unknown>;\n /**\n * Markdown body content after the front matter fence.\n */\n content: string;\n};\n\n/**\n * Reads optional YAML front matter and returns metadata plus Markdown body.\n *\n * @deprecated Prefer `new Featherdown({ frontmatter: \"auto\" }).parse(markdown)` for new code.\n * That path returns a full `FeatherdownResult`; this function uses a separate strict front-matter-only contract.\n * This strict front matter utility remains available for compatibility.\n *\n * Throws when front matter exists but is invalid YAML, or when the root value\n * is not a mapping object.\n */\nexport function parseMarkdownFile(raw: string): ParsedMarkdownFile {\n const { body, frontmatter } = extractFrontMatterStrict(raw);\n return { frontMatter: frontmatter, content: body };\n}\n"]}
package/dist/node.d.ts CHANGED
@@ -1,5 +1,48 @@
1
- import { a as RenderMarkdownOptions } from './types-DlRranpy.js';
1
+ import { a as FeatherdownOptions, F as FeatherdownResult, b as RenderMarkdownOptions } from './types-Blk9BrZ4.js';
2
+ export { F as FeatherdownDiagnosticsError } from './featherdownDiagnosticsError-CE9gG3W7.js';
2
3
 
4
+ /**
5
+ * Node-only Mermaid rendering intent for {@link Featherdown} from `featherdown/node`.
6
+ * SVG rendering uses the optional Playwright peer; see `featherdown` docs.
7
+ */
8
+ type NodeFeatherdownMermaidOptions = {
9
+ render: 'svg';
10
+ };
11
+ /**
12
+ * {@link FeatherdownOptions} plus optional Mermaid SVG rendering (Node entry only).
13
+ */
14
+ type NodeFeatherdownOptions = FeatherdownOptions & {
15
+ mermaid?: false | NodeFeatherdownMermaidOptions;
16
+ };
17
+ /**
18
+ * Per-call options for Node {@link Featherdown.parse} / {@link Featherdown.parseFile}.
19
+ */
20
+ type NodeFeatherdownParseOptions = NodeFeatherdownOptions;
21
+
22
+ /**
23
+ * Node {@link Featherdown}: same {@link Featherdown.parse} behavior as the browser
24
+ * entry when Mermaid SVG is off; delegates to the base class. With `mermaid: { render: "svg" }`,
25
+ * uses the inline-SVG Mermaid pipeline and sets {@link FeatherdownResult.assets.features.mermaid}.
26
+ */
27
+ declare class Featherdown {
28
+ private readonly base;
29
+ private readonly ctorOptions;
30
+ constructor(options?: NodeFeatherdownOptions);
31
+ parse(markdown: string, parseOptions?: NodeFeatherdownParseOptions): Promise<FeatherdownResult>;
32
+ parseFile(path: string, parseOptions?: NodeFeatherdownParseOptions): Promise<FeatherdownResult>;
33
+ }
34
+
35
+ /**
36
+ * Node-only Mermaid rendering entrypoint.
37
+ *
38
+ * @deprecated Prefer `new Featherdown({ mermaid: { render: "svg" } }).parse(markdown)` from `featherdown/node`.
39
+ * This helper remains available for compatibility.
40
+ *
41
+ * Renders Markdown to sanitized HTML with Mermaid diagrams expanded to inline
42
+ * SVG using the Node publishing pipeline. If an individual Mermaid block fails
43
+ * to render, that block is preserved as a normal code fence while the rest of
44
+ * the document continues rendering.
45
+ */
3
46
  declare function renderMarkdownToHtmlWithMermaid(markdown: string, options?: RenderMarkdownOptions): Promise<string>;
4
47
 
5
- export { RenderMarkdownOptions, renderMarkdownToHtmlWithMermaid };
48
+ export { Featherdown, type NodeFeatherdownMermaidOptions, type NodeFeatherdownOptions, type NodeFeatherdownParseOptions, RenderMarkdownOptions, renderMarkdownToHtmlWithMermaid };