@dogsbay/format-starlight 0.2.0-beta.13 → 0.2.0-beta.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,10 +13,70 @@
13
13
  * - The adapter pattern for site-specific component mappings
14
14
  */
15
15
  import type { TreeNode } from "@dogsbay/types";
16
- import type { SiteAdapter } from "./adapter.js";
16
+ import type { IncludeOptions, SiteAdapter } from "./adapter.js";
17
+ /**
18
+ * MDX reads the TEXT inside JSX/HTML elements as Markdown; a raw HTML block
19
+ * here is emitted as it is. Two Markdown forms in that text then broke the
20
+ * page: a code span (`` `Array<String>` `` in a `<td>` — the browser read
21
+ * `<String>` as a tag and the type vanished; 10 on the Cloudflare corpus) and
22
+ * a backslash escape (`Promise\<InstanceStatus>` inside `<code>` showed the
23
+ * backslash). Both become their HTML: `<code>` with escaped text, `&lt;`.
24
+ * Only TEXT between tags is touched — never inside a tag (attribute values)
25
+ * or inside `<pre>`, `<script>`, `<style>`.
26
+ */
27
+ export declare function mdxHtmlText(html: string): string;
28
+ /**
29
+ * MDX has no HTML blocks: every tag line is its own JSX element. Markdown's
30
+ * HTML block runs to the next BLANK line, so a component written straight
31
+ * after a `<p>…</p>` line was swallowed into it and leaked as a tag
32
+ * (`<AnchorHeading>`, `<Aside>` in Cloudflare's JSX branches). A blank line
33
+ * goes between them — only after a line that is one COMPLETE element, so an
34
+ * open `<table>` or `<ul>` that the component sits inside is left whole.
35
+ */
36
+ export declare function endHtmlBlocksAtComponents(source: string): string;
37
+ /**
38
+ * `<Feature header="…"> Paid add-on` — text after a CONTAINER's opener on
39
+ * its line — is the start of the body in MDX. The block rule took the line
40
+ * as the opener and the text was lost with no report (web3: two plan badges).
41
+ * It moves to its own line, at the opener's indent. A component after the
42
+ * opener is `normalizeJsxLines`' job; a closer on the same line is an inline
43
+ * use and is left alone.
44
+ */
45
+ export declare function splitContainerOpenerText(source: string, isContainer: (tag: string) => boolean): string;
17
46
  export interface ParseOptions {
18
47
  adapter?: SiteAdapter;
48
+ /**
49
+ * The page's front matter, when the caller has already split it off (the
50
+ * CLI parses the BODY). Components that read it (`<ProductReleaseNotes>`)
51
+ * otherwise saw nothing.
52
+ */
53
+ frontmatter?: Record<string, unknown>;
19
54
  /** Directory containing partial MDX files for <Render> resolution */
20
55
  partialsDir?: string;
56
+ /** How partials are resolved (inline, or template-page directives). */
57
+ includeOptions?: IncludeOptions;
58
+ /**
59
+ * Called with the tag name of every component DROPPED from the output —
60
+ * one that no builtin and no adapter mapping claimed.
61
+ *
62
+ * A dropped component is content that is not on the page. Cloudflare's
63
+ * `<AiSearchOverviewDiagram />` is the architecture diagram at the top of
64
+ * the AI Search overview; it vanished with no trace, and the only way to
65
+ * find out was to compare the converted page against the live one by eye.
66
+ * The importer knows at the moment it happens — this is how it says so.
67
+ */
68
+ onDrop?: (tag: string) => void;
69
+ /**
70
+ * Accessible description for a component we cannot render, if one can be
71
+ * found — used to leave a described placeholder instead of a hole.
72
+ *
73
+ * Cloudflare's diagrams are 478-line Astro components: inline SVG, a web
74
+ * component and CSS animation, with no image file anywhere. Nothing can
75
+ * convert that. But each carries an `aria-label` written by their docs team
76
+ * ("AI Search is a managed search primitive: you upload or connect your
77
+ * content…"), which IS the information the diagram conveys — and it was
78
+ * being thrown away with the markup.
79
+ */
80
+ describeComponent?: (tag: string) => string | undefined;
21
81
  }
22
82
  export declare function starlightToTree(source: string, options?: ParseOptions): TreeNode[];