/** * Walking markdown code fences, blockquotes included. * * Three places need to know whether a line sits inside a fence: the scanner * (so a `[/DOC]` shown in a fence isn't mistaken for the real closer), the * island splitter, and the projection's mask (so `{ a: 1 }` in a fence isn't * compiled as a Svelte expression). They agreed on everything except that a * fence can also open inside a blockquote — CommonMark allows it, and a * GitHub-style callout is the common case: * * > [!IMPORTANT] * > ```js * > export default { outDir: 'docs-dist' }; * > ``` * * Read as prose, that middle line hands Svelte an object literal and the page * fails to compile. One stepper, used by all three, keeps them from drifting. */ /** An open fence: its marker char, its length, and whether it opened inside a * blockquote. Null when no fence is open. */ export type FenceState = { marker: string; len: number; inQuote: boolean; } | null; /** * Advance `state` by one line. * * `fence` marks the opener/closer lines themselves; `inside` marks lines the * fence covers, openers and closers included. A caller that treats code as * opaque can just check `inside`. */ export declare function stepFence(state: { fence: FenceState; }, line: string): { fence: boolean; inside: boolean; };