/** * Custom subset reStructuredText parser for ContextAtlas ADR ingestion. * * Approach (b) per v0.7 Step 2.1.a Q3 lock: target the ADR-relevant * rST surface rather than full spec compliance. Scope: * * - Document title (first underlined line; optional overline) * - Field list metadata at top of document (`:Field: value`) * - Section headers via adornment-hierarchy (first-occurrence * character determines level, bounded to top-level + one level * of nesting; deeper nesting collapses to nearest-known level) * - Plain text content within sections (paragraphs) * - Inline hyperlink references (`text `__ → `text (url)`) * * NOT supported (deliberately, per Scope γ' v0.7 envelope): * - rST directives (`.. note::`, `.. code-block::`) * - Substitution references * - Footnotes, citations * - Tables (simple + grid) * - Transition lines * - Roles, inline markup beyond literal/emphasis pass-through * * If a real-world ADR exercises features beyond the supported subset, * the parser falls back to plain-text passthrough rather than failing — * unsupported constructs end up as literal characters in section body * text, which the downstream LLM extractor can still reason about. * * Primary v0.7 consumer: `parseRstSymbols` mirrors * `parseFrontmatterSymbols` so that the extraction pipeline can pull * a `:symbols:` field list out of an rST ADR exactly the way it pulls * `symbols:` out of YAML frontmatter from a Markdown ADR. * * Secondary v0.7+ consumer: `parseRst` produces structured output * (`ParsedRst`) used by the generate-adrs reference-context feature * at Step 2.2.a per Path 1 scope expansion. */ export type RstFieldList = Readonly>; export interface RstSection { /** Section title text. */ readonly title: string; /** * Adornment-hierarchy level. Level 1 = first adornment character * encountered; level 2 = second; deeper nesting collapses to the * nearest-known level per ADR-relevant-subset simplification. */ readonly level: number; /** Raw paragraph text within the section, hyperlinks normalised. */ readonly body: string; } export interface ParsedRst { /** Document title if a top-level adornment surfaces one. */ readonly title?: string; /** Field list metadata captured from the document header block. */ readonly fieldList: RstFieldList; /** Sections in document order. */ readonly sections: readonly RstSection[]; } /** * Mirror of `parseFrontmatterSymbols` for rST documents. Returns * `:symbols:` field-list values as an array of strings; empty array * when no `:symbols:` field is present or its values are not strings. * * Field-list `:symbols:` accepts either a single-line comma-separated * value or an indented multi-line list (one symbol per indented * `- name` entry) — both shapes are seen in the wild. */ export declare function parseRstSymbols(content: string): string[]; /** * Parse a reStructuredText document into a structured representation. * The parser is best-effort against the ADR-relevant subset declared * at the top of this module; unsupported constructs fall through as * plain text in section bodies. */ export declare function parseRst(content: string): ParsedRst; //# sourceMappingURL=rst-parser.d.ts.map