/** * The answers written into the text of an exercise (#1225): `[[water]]`, * `[[colour | color]]` (accepted answers), `[[go | (goes) | going]]` (an * inline choice, the one in parentheses right), with optional attributes * right after (`[[went]]{width=6}`). Read only inside a `:::exercise`, so * no other document changes. * * A gap is set as a chip (the chip path measures, breaks and paints it on * every output): the parser replaces it with {@link GAP_PLACEHOLDER} while * the source is mapped, then with the chip placeholder, its span carrying * `chip.gap`. The exercise expansion (`exercises/expand.ts`) gives the chip * its style and decides what it shows. */ import type { DirectiveAttrs, ExerciseGap, InlineSpan } from './types.js'; /** Stands for a `[[…]]` while the source is mapped (see `buildBlockMapping`). */ export declare const GAP_PLACEHOLDER = "\uE1AC"; /** The chip style id a gap takes until the expansion resolves it. */ export declare const GAP_CHIP_STYLE = "__postext-gap"; /** A gap as written. */ export interface GapMeta { /** The options, as written between the `|` (trimmed, parentheses kept). */ raw: string[]; attrs?: DirectiveAttrs; sourceStart: number; sourceEnd: number; } /** Where the `]]` closing a gap opened at `from` (just past `[[`) stands, * or -1: a backslash escapes, a single `[`…`]` pair inside is kept. */ export declare function gapCloseAt(text: string, from: number): number; /** Take every `[[…]]` (with its `{…}`) out of `text`, each replaced by * {@link GAP_PLACEHOLDER}. `fallbackStart` is the text's source offset. */ export declare function extractExerciseGaps(text: string, fallbackStart: number): { cleaned: string; gaps: GapMeta[]; }; /** What a gap asks: the options read for their inline Markdown, the right * ones, whether it is a choice. With two options or more and at least * one in parentheses it is an inline choice; otherwise every option is * an accepted answer. */ export declare function gapOf(meta: GapMeta): ExerciseGap; /** Put a chip span with its `gap` at each {@link GAP_PLACEHOLDER}. The * chip's words are the first right answer. */ export declare function injectGapSpans(spans: InlineSpan[], gaps: GapMeta[]): InlineSpan[]; /** A mapped run with its gap placeholders turned into chip placeholders, * once the source map no longer needs them. */ export declare function settleGapPlaceholders(mapping: T): T; //# sourceMappingURL=exerciseGaps.d.ts.map