/** * Markdown content formats. Two shapes funnel through here: * * · `site.standard.content.markdown` — the canonical Standard Site markdown * block (also what Greengale documents are normalized to on ingest). * · markdown-in-record third-party lexicons (Lemma, wtr, unthread, lichen, …) * whose body is a markdown string under a format-specific key. * * Every one is parsed with the unified/remark ecosystem * (`mdast-util-from-markdown` + GFM) into an mdast tree, then mapped onto the * shared {@link StructuredRenderableBlock} vocabulary — the same blocks every * framework renderer already consumes, so markdown renders identically across * them with no per-format or per-renderer code. Inline emphasis/links become * byte-indexed AT-Proto facets, exactly like the ProseMirror/BlockNote parsers. */ import type { StructuredRenderableBlock, StructuredText } from "./types.js"; /** Every markdown content `$type` the parser understands. */ export declare const MARKDOWN_FORMATS: string[]; /** Whether `format` is a known markdown content `$type`. */ export declare function isMarkdownFormat(format: string | null | undefined): boolean; /** * Raw markdown body from a markdown `content` payload, or null. The format is * resolved from `content.$type`, falling back to the stored `contentFormat`. */ export declare function markdownText(content: unknown, contentFormat?: string | null): string | null; /** Markdown dialect. `commonmark` drops the GFM extension (tables, task * lists, autolinks, strikethrough). */ export type MarkdownFlavor = "gfm" | "commonmark"; /** * Renderable blocks for a raw markdown string, or null when it is blank or * parses to nothing. Formats that carry markdown but need normalizing first * (Markpub strips front matter and applies facets) go through here rather than * {@link markdownBlocks}. */ /** * A parsed markdown body: its blocks, plus any GFM footnotes. * * Footnotes need their own channel because they are not blocks — they are * endnotes referenced from inline text, and the render tree models them that * way (`DocumentTree.footnotes` + `footnoteNumbers`). */ export interface MarkdownDocument { blocks: Array; footnotes: Array<{ id: string; text: StructuredText; }>; } /** Parse markdown into blocks *and* footnotes. */ export declare function markdownDocumentFromText(text: string, flavor?: MarkdownFlavor): MarkdownDocument | null; export declare function markdownBlocksFromText(text: string, flavor?: MarkdownFlavor): Array | null; /** * Renderable blocks for a markdown `content` payload, or null when the format * isn't markdown or the body is empty. Registered for every * {@link MARKDOWN_FORMATS} entry so {@link structuredFormatBlocks} — and thus * `buildRenderTree` — handles markdown like any other structured format. */ export declare function markdownBlocks(content: unknown, contentFormat?: string | null): Array | null; //# sourceMappingURL=markdown.d.ts.map