Skip to content

embed-transform.ts#

View Markdown

Source

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

4 symbols 1 functions 2 variables 1 modules 2 parameters 1 returns

Reference#

moduleembed-transformReserve first-party embed components so MDX island lowering cannot swallow them. Rust still emits data-ox-island for ev…

Reserve first-party embed components so MDX island lowering cannot swallow them.

Rust still emits data-ox-island for every PascalCase tag. This rewrite turns reserved built-in names back into HTML tags so transformBuiltinEmbeds can run. A document-local import of the same name keeps the island.

View source

variableconst PAYLOAD_SCRIPT = /^\s*<script type="application\/json">[\s\S]*?<\/script>/Reserve first-party embed components so MDX island lowering cannot swallow them…

Reserve first-party embed components so MDX island lowering cannot swallow them.

Rust still emits data-ox-island for every PascalCase tag. This rewrite turns reserved built-in names back into HTML tags so transformBuiltinEmbeds can run. A document-local import of the same name keeps the island.

Signature

const PAYLOAD_SCRIPT = /^\s*<script type="application\/json">[\s\S]*?<\/script>/

View source

variableconst RESERVED_BUILTIN_COMPONENTS = [ "GitHub", "OgCard", "Tweet", "XPost", "Reddit", "Bluesky", "GoogleMaps", "Qiita", "Zenn", "NpmPackage", "CratesIo", "PyPI", "DockerHub", "CodePen", "JSFiddle", "Observable", "Vimeo", "Twitch", "Discord", "Fediverse", "Mastodon", "Misskey", "Mixi2", "Facebook", "Threads", "Instagram", "Spotify", "AppleMusic", "SpeakerDeck", "Audio", "Video", "StackBlitz", "WebContainer", "YouTube", "NotByAI", ] as constCanonical PascalCase names for first-party embed / media components. Keep in sy…

Canonical PascalCase names for first-party embed / media components. Keep in sync with SELF_CLOSING_EMBED_TAG in ./index.ts.

Signature

export const RESERVED_BUILTIN_COMPONENTS = [
  "GitHub",
  "OgCard",
  "Tweet",
  "XPost",
  "Reddit",
  "Bluesky",
  "GoogleMaps",
  "Qiita",
  "Zenn",
  "NpmPackage",
  "CratesIo",
  "PyPI",
  "DockerHub",
  "CodePen",
  "JSFiddle",
  "Observable",
  "Vimeo",
  "Twitch",
  "Discord",
  "Fediverse",
  "Mastodon",
  "Misskey",
  "Mixi2",
  "Facebook",
  "Threads",
  "Instagram",
  "Spotify",
  "AppleMusic",
  "SpeakerDeck",
  "Audio",
  "Video",
  "StackBlitz",
  "WebContainer",
  "YouTube",
  "NotByAI",
] as const

View source

fnrestoreReservedBuiltinIslands(html: string, localNames?: Iterable<string>): stringReplace reserved built-in islands with the original HTML tags so embed transfor…

Replace reserved built-in islands with the original HTML tags so embed transforms can see them. Document-local bindings of the same name stay islands.

Signature

export function restoreReservedBuiltinIslands(html: string, localNames?: Iterable<string>): string

View source

Parameters

  • html string
  • localNames Iterable<string>

    optional

Returns

string