/** * Markpub (`at.markpub.markdown`) — the markdown content format used by * Mochott and anything else built on the Markpub lexicon. * * Unlike the plain markdown-in-record formats (see `markdown.ts`), a Markpub * payload is markdown *plus* out-of-band metadata: * * · `flavor` — `gfm` (default) or `commonmark`. * · `extensions` — declared syntax extensions (`yaml`, `latex`, …). * · `frontMatter` — when present (or the `yaml` extension is declared), a * leading YAML block is metadata, not body. * · `text.facets` — byte-indexed facets over the *markdown source*. Most are * redundant with the syntax already in the source, but some formats * (headers, strong, horizontal rules, front matter) are expressed *only* * as facets, with the source left unmarked. * · `text.lenses` — alias groups that map a publisher's own facet `$type`s * onto the canonical ones. * * So rendering is: normalize facet `$type`s through the lenses, rewrite the * facet-only constructs back into markdown syntax, strip front matter, then * hand the result to the shared markdown parser. Everything lands in the same * {@link StructuredRenderableBlock} vocabulary as every other format — no * Markpub-specific node types and no per-renderer code. * * Two knowingly-dropped details: `#idify` heading anchors (the block * vocabulary has no heading id) and the `latex` extension (core's markdown * parser has no math extension, so `$$…$$` stays literal text). */ import type { LeafletFacet } from "../../leaflet/types.js"; import type { MarkdownDocument, MarkdownFlavor } from "./markdown.js"; import type { StructuredRenderableBlock } from "./types.js"; export declare const MARKPUB_MARKDOWN = "at.markpub.markdown"; export declare const MARKPUB_TEXT = "at.markpub.text"; /** Content `$type`s handled by this module. */ export declare const MARKPUB_FORMATS: string[]; export declare function isMarkpubFormat(format: string | null | undefined): boolean; /** A lens: a group of facet `$type`s that all mean the same thing. */ export interface MarkpubLens { facets: Array<{ $type?: string; }>; } export interface MarkpubDocument { markdown: string; flavor: MarkdownFlavor; extensions: Array; frontMatter: Array; facets: Array; lenses: Array; } /** Parse an `at.markpub.markdown` (or bare `at.markpub.text`) payload. */ export declare function parseMarkpubContent(content: unknown): MarkpubDocument | null; /** Rewrite facet feature `$type`s onto their canonical form via the lenses. */ export declare function normalizeMarkpubFacets(facets: Array, lenses: Array): Array; /** * Apply Markpub facets to the markdown source. Applied back-to-front so each * splice leaves earlier byte offsets valid. */ export declare function applyMarkpubFacets(markdown: string, facets: Array): string; export interface PreparedMarkpubMarkdown { body: string; flavor: MarkdownFlavor; } /** * Normalize an `at.markpub.markdown` payload into plain renderable markdown: * strip front matter, apply facet transforms, honor the declared flavor. */ export declare function prepareMarkpubMarkdown(content: unknown): PreparedMarkpubMarkdown | null; /** * Renderable blocks for an `at.markpub.markdown` payload, or null when the * format doesn't match or the body is empty. Registered for every * {@link MARKPUB_FORMATS} entry so `buildRenderTree` handles Markpub like any * other structured format. */ export declare function markpubBlocks(content: unknown, contentFormat?: string | null): Array | null; /** Blocks *and* footnotes for a Markpub payload; see `markdownDocumentFromText`. */ export declare function markpubDocument(content: unknown, contentFormat?: string | null): MarkdownDocument | null; //# sourceMappingURL=markpub.d.ts.map