@r4ai/remark-embed
Version:
[](https://jsr.io/@r4ai/remark-embed) [](https://codecov.io/gh/r4ai/remark-embed) [ => url.hostname === "example.com"
*/
match: (url: URL) => boolean;
/**
* The function to fetch the oEmbed data for the URL.
*
* @param url The URL to fetch.
* @returns Fetch response containing the oEmbed data for the URL.
* @example (url) => fetch(`https://example.com/oembed?${new URLSearchParams({ url: url.href })}`)
*/
response: (url: URL) => Promise<Response>;
}>;
/**
* The post-processor for the HTML content to embed.
* @param html The `html` field of the oEmbed metadata.
* @returns The processed HTML content.
*/
postProcess?: (html: string) => string;
/**
* The transformer for the photo type of oEmbed.
*
* @see https://oembed.com/#:~:text=2.3.4.1.%20The%20photo%20type
* @param url The URL to embed.
* @param oEmbed The oEmbed metadata for the {@link url}
* @param options The options for the {@link transformerOEmbed}
* @returns The element to embed the photo.
* @defaultValue {@link defaultTransformerOEmbedOptions.photo}
*/
photo?: (url: URL, oEmbed: DeepReadonly<OEmbedPhoto>, options: DeepRequired<DeepReadonly<TransformerOEmbedOptions>>) => Element;
/**
* The transformer for the video type of oEmbed.
*
* @see https://oembed.com/#:~:text=2.3.4.2.%20The%20video%20type
* @param url The URL to embed.
* @param oEmbed The oEmbed metadata for the {@link url}
* @param options The options for the {@link transformerOEmbed}
* @returns The element to embed the video.
* @defaultValue {@link defaultTransformerOEmbedOptions.video}
*/
video?: (url: URL, oEmbed: DeepReadonly<OEmbedVideo>, options: DeepRequired<DeepReadonly<TransformerOEmbedOptions>>) => Element;
/**
* The transformer for the rich type of oEmbed.
*
* @see https://oembed.com/#:~:text=2.3.4.4.%20The%20rich%20type
* @param url The URL to embed.
* @param oEmbed The oEmbed metadata for the {@link url}
* @param options The options for the {@link transformerOEmbed}
* @returns The element to embed the rich content.
* @defaultValue {@link defaultTransformerOEmbedOptions.rich}
*/
rich?: (url: URL, oEmbed: DeepReadonly<OEmbedRich>, options: DeepRequired<DeepReadonly<TransformerOEmbedOptions>>) => Element;
/**
* The transformer for the link type of oEmbed.
*
* @see https://oembed.com/#:~:text=2.3.4.3.%20The%20link%20type
* @param url The URL to embed.
* @param oEmbed The oEmbed metadata for the {@link url}
* @param options The options for the {@link transformerOEmbed}
* @returns The element to embed the link.
* @defaultValue {@link defaultTransformerOEmbedOptions.link}
*/
link?: (url: URL, oEmbed: DeepReadonly<OEmbedLink>, options: DeepRequired<DeepReadonly<TransformerOEmbedOptions>>) => Element;
};
export declare const defaultTransformerOEmbedOptions: DeepRequired<DeepReadonly<TransformerOEmbedOptions>>;
/**
* A transformer for oEmbed.
* Embeds the content of the URL using the oEmbed metadata.
* @see {@link https://oembed.com/ | oembed.com}
*
* @example
* ```ts
* const html = (
* await unified()
* .use(remarkParse)
* .use(remarkRehype)
* .use(remarkEmbed, {
* transformers: [transformerOEmbed()],
* })
* .use(rehypeStringify)
* .process(md)
* ).toString()
* ```
*/
export declare const transformerOEmbed: (_options?: TransformerOEmbedOptions) => Transformer;
//# sourceMappingURL=oembed.d.ts.map