import { Node } from '@tiptap/core'; import type { marked } from 'marked'; declare module '@tiptap/core' { interface Commands { frontmatter: { /** Add an empty frontmatter block at the top of the document. */ setFrontmatter: () => ReturnType; /** Drop the fences, keeping the metadata as ordinary content. */ unsetFrontmatter: () => ReturnType; }; } } /** * Registers the frontmatter tokenizer on a marked instance. * * Registered with marked directly rather than through the node's * `markdownTokenizer` hook, because that hook drops the lexer before calling us * and the lexer carries the one signal that matters here. * * Marked lexes the inside of a blockquote with a fresh token array, so "nothing * tokenized yet" is true in there too. A frontmatter node inside a container is * invalid under the document schema, and since `Node.fromJSON` does not * validate, it survives until a path that does (the DOM parser, y-prosemirror) * prunes it, taking the surrounding content with it. * * Only the top level pass is handed the lexer's own token list, so comparing the * two tells us where we are. `state.top` looks like the right flag but is not: * marked sets it to true for blockquote contents as well. * * Takes the instance as an argument instead of reaching for marked's singleton: * every `MarkdownManager` appends its tokenizers to whichever instance it is * given and never removes them, so the singleton would grow for as long as the * tab is open and hold on to every manager it ever saw. */ export declare function registerFrontmatterTokenizer(instance: typeof marked): void; /** * Frontmatter is metadata, not prose. Marked has no rule for it, so without * this node the opening `---` lexes as a thematic break and the metadata turns * into paragraphs and headings, which destroys it on the next save. * * The node keeps the metadata as plain, unformatted text and hands it back * between its fences untouched. It behaves like a code block: editable, but * nothing the editor does to it can change more than the characters the user * typed. */ export declare const Frontmatter: Node;