Skip to content

index.ts#

View Markdown

Source

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

6 symbols 3 functions 1 interfaces 1 variables 1 modules 5 parameters 9 members 3 returns

Reference#

moduleindexox-content Built-in Plugins All plugins are designed with No-JavaScript-First principle. They generate static HTML at b…

ox-content Built-in Plugins

All plugins are designed with No-JavaScript-First principle. They generate static HTML at build time and require no client-side JS.

View source

fnnormalizeSelfClosingEmbeds(html: string): stringCustom embed tags are not HTML void elements, so a self-closing authoring form…

Custom embed tags are not HTML void elements, so a self-closing authoring form like <GitHub ... /> reaches the HTML re-parsers (syntax highlighting, embed transforms) as an unclosed element that swallows the rest of the document. Normalize to an explicit open/close pair before any rehype pass runs. A leftover </Tweet> after /> (CommonMark HTML + self-close) is consumed so the closer cannot survive the embed rewrite.

The tag list is built from the provider registry rather than written out here. It had drifted: <CodeSandbox … /> was absent, so a page using the self-closing form lost every element after it.

Signature

export function normalizeSelfClosingEmbeds(html: string): string

View source

Parameters

  • html string

Returns

string
interfaceTransformAllOptions extends MediaEmbedOptionsTransform all plugin components in HTML. Call this during SSG build to process…

Transform all plugin components in HTML. Call this during SSG build to process all plugins at once.

Signature

export interface TransformAllOptions extends MediaEmbedOptions

View source

Members

Properties
NameTypeDescription
githuboptional boolean | GitHubOptions
githubTokenoptional string
graphvizoptional boolean | GraphvizOptions
mermaidoptional boolean
ogpoptional boolean | OgpOptions
openGraphoptional boolean | OgpOptions
pmoptional boolean | PmOptions
Expand <pm> package-manager blocks into install tabs. Pass an object to
opt in to synced groups ({ sync: true }); syncing is off by default.
Default false
tabsoptional boolean
youtubeoptional boolean
fntransformAllPlugins(html: string, options: TransformAllOptions = {}): Promise<string>Transform all enabled plugins in HTML content.

Transform all enabled plugins in HTML content.

Signature

export async function transformAllPlugins(html: string, options: TransformAllOptions = {}): Promise<string>

View source

Parameters

Returns

Promise<string>
fntransformBuiltinEmbeds(html: string, options: { github: GitHubOptions | false; openGraph: OgpOptions | false; pm?: PmOptions | false; /** * Document-local import bindings. A reserved built-in name in this set * stays an MDX island instead of running the first-party embed transform. */ localNames?: Iterable<string>; } & MediaEmbedOptions): Promise<string>Transform built-in embed components in HTML content.

Transform built-in embed components in HTML content.

Signature

export async function transformBuiltinEmbeds(html: string, options: {
    github: GitHubOptions | false;
    openGraph: OgpOptions | false;
    pm?: PmOptions | false;
    /**
     * Document-local import bindings. A reserved built-in name in this set
     * stays an MDX island instead of running the first-party embed transform.
     */
    localNames?: Iterable<string>;
  } & MediaEmbedOptions): Promise<string>

View source

Parameters

  • html string
  • options { github: GitHubOptions | false; openGraph: OgpOptions | false; pm?: PmOptions | false; localNames?: Iterable<string> } & MediaEmbedOptions

Returns

Promise<string>
variableconst TYPESCRIPT_ONLY_EMBED_TAGS = ["GitHub", "OgCard", "Reddit", "YouTube", "NotByAI"] as constEmbed tags this package owns, which the Rust provider registry cannot name. Eve…

Embed tags this package owns, which the Rust provider registry cannot name.

Everything else in the pattern comes from the registry, because a hand-maintained copy drifts — and the drift is not cosmetic here.

Signature

const TYPESCRIPT_ONLY_EMBED_TAGS = ["GitHub", "OgCard", "Reddit", "YouTube", "NotByAI"] as const

View source