import type { ReactNode } from "react"; export type MarkdownLineProps = { className?: string; /** * Where the text that is **not** itself a link points — the task * a card opens, usually. * * Given one, every plain run becomes its own anchor to it and a * markdown link stays a separate anchor beside them. That is the * whole reason this prop exists rather than the caller wrapping * the component in an ``: an anchor inside an anchor is invalid * HTML, the browser closes the outer one, and the second half of * the title silently stops opening the task. * * Left out, the runs are plain text and only the markdown links * are clickable — which is right for a heading, a table cell, or * anywhere the line is not itself a destination. * * ⚠️ **A markdown link splits this into more than one anchor**, and * each one is named by the words it actually covers — `Ship`, then * `#53`, then `tonight`. That is honest (what is announced is what * is on screen, per WCAG 2.5.3) and it is not *good*: `tonight` is * a poor name for a link to a task. Giving them all one name was * tried and is worse — two links with the same name are ambiguous * to anything driving the page by name, which this library's own * `expectAgentDrivable` refuses outright. The conclusion is a * design one: a link usually belongs in a task's **description**, * where it has a sentence around it, rather than in its title. */ href?: string; /** * The caller has already wrapped this line in a link — so draw the * marks and emit **no anchors at all**, not even for a markdown * link. * * The third and last answer to "who owns the link here", after * `href` (this component does) and neither (the markdown links do, * and nothing else is clickable). It exists because a whole-card * link is a real and common shape — Docket's triage cards wrap the * title *and* the body, so middle-click opens the proposal — and * inside one, an anchor of any kind is an anchor inside an anchor. * * That trap has teeth even when no author ever typed a link: a * **bare URL autolinks**, so a captured note whose title ends in * `https://…` would nest one without anybody writing `[]()`. * * A markdown link's text still renders, with its marks; it simply * does not navigate on its own. The card's link is what a click * follows. */ isInsideLink?: boolean; /** * The markdown. **Inline constructs only** — see * `inlineMarkdown.ts`; a `#` or a `- ` is a literal character * here, and a newline collapses to a space. */ value: string; }; /** * One line of markdown, drawn with its inline marks and nothing * else. * * A **title** is what this is for. Docket's cards carry names like * ``Ingest 53 movies from `Downloads/MOVIES` into `G:\Movies` ``, * and a grid of them set in one flat weight is a wall the eye cannot * scan — the parts that differ between two cards are exactly the * parts markdown would have marked. So the marks earn their place * by making a list of names *scannable*, which is the same argument * as the priority bar and the project colour, one layer down. * * ### It is not a small `MarkdownView` * * `MarkdownView` renders a document, through CodeMirror, from the * optional `@charcuterie/ui/markdown-editor-codemirror` entry point. * Neither half of that suits a name: an editor state and a syntax * tree per card is an absurd price for forty characters, and the * main entry may not reach the CodeMirror stack at all. This parses * the inline grammar directly and returns spans. * * The two therefore have to agree, and `inlineMarkdown.ts` says how * that is kept true — most importantly that both call the **same** * URL guard, `safeUrls.ts`, which moved up out of the CodeMirror * subpath when this landed. * * ### The `href` prop is the load-bearing one * * A card title is usually itself a link. A title may also *contain* * one. Nested anchors are invalid HTML and the browser silently * closes the outer element, so `href` makes the component emit * **siblings** — the plain runs anchored to `href`, the markdown * links anchored to their own destination — which reads as one * continuous line and behaves as two different destinations. * * ```tsx * * ``` * * Anywhere a *string* is required — an `aria-label`, a `title` * attribute, `document.title` — call `toPlainMarkdownText` rather * than re-stripping the markup with a regex of your own. It is the * same parse, so it cannot drift from what is on screen. */ export declare const MarkdownLine: ({ className, href, isInsideLink, value, }: MarkdownLineProps) => ReactNode; //# sourceMappingURL=MarkdownLine.d.ts.map