Skip to content

contentToMarkdown

function contentToMarkdown(doc, options?): string;

Defined in: index.ts:425

Serialize a DocumentNode (or block array) to markdown. Custom block descriptors with toMarkdown are honored; built-in types use commonmark- flavoured output that round-trips through contentFromMarkdown. Custom inline marks are serialized via their descriptor’s toMarkdown hook when the matching descriptor is passed in options.marks (e.g. a moji mark → :slug:); otherwise unknown marks are dropped and their text preserved. Blocks are joined with single newlines (block-level boundaries); insert a blank line between paragraphs explicitly via empty paragraph blocks if you want commonmark-style paragraph spacing.

ParameterType
docBlockNode[] | DocumentNode
options?{ blocks?: BlockDescriptor[]; marks?: MarkDescriptor[]; }
options.blocks?BlockDescriptor[]
options.marks?MarkDescriptor[]

string