/** * One entry point for every body-shaped argument. * * Callers hand us markdown, HTML, or a ready-made ProseMirror document, and * usually do not say which. Sniffing beats making every tool take a `format` * argument the model has to reason about and will sometimes get wrong. * * Order matters: a JSON document is unambiguous, HTML is detectable by its * tags, and markdown is the fallback because it is also what plain text is. */ import { docToMarkdown } from "./to-markdown.js"; import { type PMDoc } from "./prosemirror.js"; export type BodyFormat = "markdown" | "html" | "prosemirror" | "auto"; export declare function detectFormat(input: string): Exclude; /** * Build a Substack document from whatever the caller sent. * * Throws on an invalid ProseMirror document rather than letting a bad node name * reach Substack, which would accept it and render the post wrong with no error. */ export declare function toDoc(input: string, format?: BodyFormat): PMDoc; /** The JSON string Substack's `draft_body` field expects. */ export declare function toDraftBody(input: string, format?: BodyFormat): string; /** Read a `draft_body` back as markdown, for editing. */ export declare function draftBodyToMarkdown(raw: unknown): string; export { docToMarkdown };