/** * Targeted reads over the 2.0 model. The mirror image of {@link patch}: an * address (the same `(targetType, target)` pair a patch instruction carries) * resolves to a node, and the node's addressable value comes back. An optional * `scope` mirrors the patch scopes, with one invariant tying the two together: * *read @ scope S, then `replace` @ scope S with the value unchanged, is a * no-op.* * * - `content` (the default): a heading's body de-levelled by the target's own * level, a block's literal text, a frontmatter key's parsed value. * - `marker`: the node's label — a heading's raw text (no `#`s, and no * duplicate-disambiguation suffix), a block's bare id, a frontmatter key. * - `markerAndContent`: the whole node — a heading's subtree re-levelled to * its *parent's* baseline (its own heading line reads as `# Title`, exactly * the shape a `markerAndContent` replace consumes), a block's full span * including its `^id`, a frontmatter entry as a single-key object. * * The frontmatter `markerAndContent` read is the one deviation from the * round-trip invariant: it returns the entry as `{key: value}` — the shape a * `markerAndContent` *prepend/append* consumes — because on the write side a * frontmatter `replace` carries a plain value at either scope, so a strict * mirror would just duplicate the `content` read. * * A heading's `content` is de-levelled by the target's own level, mirroring * the baseline a `content`-scope write rebases *up* by (see `levels.ts`). * Without this, a heading's content round-trips through a content-scope write * at the wrong depth: reading section "# Overview"'s "## Details" child and * writing it straight back would rebase it to "### Details". */ import { Addressed } from "./resolve.js"; /** The scopes a read supports — the value-bearing subset of the patch scopes. */ export type ReadScope = "content" | "marker" | "markerAndContent"; /** The address of a read: the addressing subset a patch instruction uses, * plus an optional {@link ReadScope} (default `content`). */ export type ReadTarget = Addressed & { scope?: ReadScope; }; /** The result of {@link readTarget}: markdown text, or a parsed frontmatter value. */ export type ReadResult = { kind: "heading" | "block"; content: string; } | { kind: "frontmatter"; value: unknown; }; export declare const readTarget: (document: string, target: ReadTarget) => ReadResult; //# sourceMappingURL=read.d.ts.map