Skip to content

mdx-islands.ts#

View Markdown

Source

7 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

7 symbols 5 functions 1 types 1 modules 8 parameters 5 returns

Reference#

fncollectMdxIslandNamesFromHtml(html: string): string[]Collect data-ox-island names from Rust-rendered HTML. Used when an AST walk is…

Collect data-ox-island names from Rust-rendered HTML. Used when an AST walk is unavailable.

Signature

export function collectMdxIslandNamesFromHtml(html: string): string[]

View source

Parameters

  • html string

Returns

string[]
fncollectMdxJsxNamesFromAst(ast: unknown): string[]Collect named MDX JSX tags from a parsed mdast tree (JSON from NAPI parse()). F…

Collect named MDX JSX tags from a parsed mdast tree (JSON from NAPI parse()). Fragments (name: null) and non-JSX nodes are ignored. Walks nested children so inner islands are found.

Signature

export function collectMdxJsxNamesFromAst(ast: unknown): string[]

View source

Parameters

  • ast unknown

Returns

string[]
typeComponentRegistry = Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown> | Iterable<string>Global component map: object, Map, or name list.

Global component map: object, Map, or name list.

Signature

export type ComponentRegistry = Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown> | Iterable<string>

View source

fndiscoverRegisteredMdxComponents(input: DiscoverRegisteredMdxComponentsInput): Promise<string[]>Resolve registered island names for an MDX document. Prefers a NAPI parse() AST…

Resolve registered island names for an MDX document.

Prefers a NAPI parse() AST walk. Falls back to rendered data-ox-island names so plugins still hydrate if #659 metadata is not present.

Signature

export async function discoverRegisteredMdxComponents(input: DiscoverRegisteredMdxComponentsInput): Promise<string[]>

View source

Parameters

  • input DiscoverRegisteredMdxComponentsInput

Returns

Promise<string[]>
fnintersectHydratableComponentNames(names: Iterable<string>, components: ComponentRegistry, localNames?: Iterable<string>): string[]Keep names that are either globally registered or document-local bindings.

Keep names that are either globally registered or document-local bindings.

Signature

export function intersectHydratableComponentNames(names: Iterable<string>, components: ComponentRegistry, localNames?: Iterable<string>): string[]

View source

Parameters

  • names Iterable<string>
  • components ComponentRegistry
  • localNames Iterable<string>

    optional

Returns

string[]
fnintersectRegisteredComponentNames(names: Iterable<string>, components: ComponentRegistry): string[]Keep names that exist on the global component map, in first-seen order.

Keep names that exist on the global component map, in first-seen order.

Signature

export function intersectRegisteredComponentNames(names: Iterable<string>, components: ComponentRegistry): string[]

View source

Parameters

Returns

string[]
modulemdx-islandsDiscover registered MDX islands from the mdast tree or rendered HTML. Framework plugins use this instead of a source re…

Discover registered MDX islands from the mdast tree or rendered HTML.

Framework plugins use this instead of a source regex when MDX is on, so nested JSX, expression attributes, and fragments stay visible. Names that are not in the global components map and are not document-local import bindings are left as static HTML.

View source