index.ts#
6 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
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.
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): stringParameters
-
htmlstring
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 MediaEmbedOptionsMembers
Properties
| Name | Type | Description |
|---|---|---|
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 toopt 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>Parameters
-
htmlstring -
optionsTransformAllOptionsoptional · default: {}
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>Parameters
-
htmlstring
Returns
Promise<string>