/** * Markdown's **inline** half, parsed into flat runs of marked text. * * ### Why this is not the CodeMirror parser * * `@charcuterie/ui/markdown-editor-codemirror` already renders * markdown, through `@lezer/markdown`. It is the right answer for a * document and the wrong one for a **name**: an editor instance per * card is a CodeMirror state, a view, a syntax tree and a decoration * set for a string that is usually under sixty characters, and a * backlog grid draws dozens of them at once. The whole CodeMirror * stack is also an *optional peer* of this package on purpose — the * main entry may not reach it, so a title renderer that lives in the * main entry cannot borrow it even if the cost were acceptable. * * So this is a second parser, which is a thing to be nervous about: * two parsers are two answers to "what does this markdown mean", and * that divergence is exactly the bug the consumer's * renderer-agreement test exists to catch. Three things keep it * honest: * * 1. **It is inline-only, and says so.** A `#`, a `>`, a `|` table * row and a `- ` list marker are literal characters here. There * is no block level to disagree about, because there is no block * level. * 2. **The URL guard is shared, not copied.** Both surfaces call * `toSafeLinkUrl` from `../safeUrls.ts` — one module, one * allowlist. It moved up out of the CodeMirror subpath when this * landed, for that reason. * 3. **The flanking rules are CommonMark's**, not a convenient * approximation. That is what makes `ingest_the_files.sh` a file * name rather than a title with an italic word in the middle of * it, and file names in titles are the case this was built for. * * ### The shape it produces * * A **flat** list of runs, not a tree. Marks compose by set union, so * `**bold [link](/x) tail**` is three runs that all carry `isStrong` * and of which one carries an `href` — which is precisely the shape * `MarkdownLine` needs to render a link *beside* the surrounding * anchor rather than inside it. A tree would have to be flattened * back into this before it could be drawn. */ /** * One run of text, with every mark that covers it. * * `href` is present only on a run that came from `[text](url)` or * from a bare URL — never inherited from the caller's own link. Who * the *plain* text points at is `MarkdownLine`'s question, not the * parser's. */ export type InlineMarkdownRun = { href?: string; isCode: boolean; isEmphasis: boolean; isStrikethrough: boolean; isStrong: boolean; text: string; }; /** * The inline runs of `value`, in order. * * Exported because a consumer occasionally needs the runs without * React — Docket's search highlighter walks them to find which run a * match landed in — and because it is the seam every test in this * directory drives. */ export declare const toInlineMarkdownRuns: (value: string) => InlineMarkdownRun[]; /** * The same string with its markers **gone** — what the title says, * with nothing about how it is painted. * * This is not a convenience. Every `aria-label`, `title` attribute, * `document.title` and confirmation sentence that names a task needs * the words without the punctuation, and deriving it from the same * parse is the only way it cannot drift from what is on screen. A * second regex that "strips markdown" is how the card comes to read * `Ingest 53 movies` while the tooltip reads * `Ingest 53 movies from ⁠`Downloads/MOVIES⁠``. */ export declare const toPlainMarkdownText: (value: string) => string; //# sourceMappingURL=inlineMarkdown.d.ts.map