import { StreamParser } from '@codemirror/language'; import { MarkdownEditorHighlightColor } from './types'; /** * Markdown highlighting for the source mode, as a CodeMirror stream parser. * * The package ships no Markdown grammar, and the source view only needs to * show structure, not parse it: markers are dimmed, headings, emphasis, code, * links and formulas are styled, and code blocks and `$$` blocks are tracked * across lines so their content is never read as Markdown. Inline state * (emphasis, a link being read) ends with the line. */ interface MarkdownStreamState { /** The fence that opened the code block the line is in. */ fence: string | null; mathBlock: boolean; htmlComment: boolean; /** Whether a block marker can still start here: line start, after `>` or a list marker. */ lineStart: boolean; heading: number; quote: boolean; /** The line before was quoted: a `>` here continues that quote. */ quoteAbove: boolean; /** A top-level quote starts on this line, so a callout's marker can follow its `>`. */ calloutLine: boolean; /** A list marker was read on this line, so `[ ]` is a task box. */ item: boolean; /** The line starts with `|`: its pipes are cell borders. */ table: boolean; strong: boolean; emphasis: boolean; strike: boolean; /** Inside `==text==`: where on the line its closing `==` is; -1 outside. */ markEnd: number; /** Inside ``: its colour. */ htmlMark: MarkdownEditorHighlightColor | null; /** 1 inside a link's `[label]`, 2 inside its `(destination)`. */ link: 0 | 1 | 2; } export interface MarkdownStreamOptions { math: boolean; highlight: boolean; callouts: boolean; } /** Whether `line` closes a block opened by `fence`: the same character, at least as long. */ export declare function closesFence(line: string, fence: string): boolean; /** * Whether the line starting at `lineStart` is inside a fenced code block (or * a `$$` block), counted from the top of `doc`: the keys that continue lists * must leave code alone. */ export declare function isInsideMarkdownFence(doc: string, lineStart: number, math: boolean): boolean; export declare function markdownStreamParser(options: MarkdownStreamOptions): StreamParser; export {};