UNPKG

@r4ai/remark-embed

Version:

[![JSR](https://jsr.io/badges/@r4ai/remark-embed)](https://jsr.io/@r4ai/remark-embed) [![codecov](https://codecov.io/gh/r4ai/remark-embed/graph/badge.svg?token=B9EZXC0PR8)](https://codecov.io/gh/r4ai/remark-embed) [![CI](https://github.com/r4ai/remark-emb

71 lines 1.87 kB
import type { Root } from "mdast"; import type { Plugin } from "unified"; import type { Transformer } from "./index.js"; /** * Options for the {@link remarkEmbed} plugin. */ export type RemarkEmbedOptions = { /** * A list of transformers. * Each transformer is executed in sequence from beginning to end. * @see {@link Transformer} */ transformers: Transformer[]; }; /** * Default options for the {@link remarkEmbed} plugin. */ export declare const defaultRemarkEmbedOptions: Readonly<RemarkEmbedOptions>; /** * A remark plugin to embed the content of the URL. * * @example * ```ts * import rehypeStringify from "rehype-stringify" * import remarkParse from "remark-parse" * import remarkRehype from "remark-rehype" * import { unified } from "unified" * import remarkEmbed from "./src/index.js" * import { transformerOEmbed } from "./src/transformers" * * const md = ` * <https://www.youtube.com/watch?v=jNQXAC9IVRw> * ` * * const html = ( * await unified() * .use(remarkParse) * .use(remarkRehype) * .use(remarkEmbed, { * transformers: [transformerOEmbed()], * }) * .use(rehypeStringify) * .process(md) * ).toString() * * console.log(html) * ``` * * Yields: * * ```html * <p> * <div class="oembed-video"> * <iframe * width="200" * height="150" * src="https://www.youtube.com/embed/jNQXAC9IVRw?feature=oembed" * frameborder="0" * allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" * referrerpolicy="strict-origin-when-cross-origin" * allowfullscreen * title="Me at the zoo"> * </iframe> * </div> * </p> * ``` */ export declare const remarkEmbed: Plugin<[ (RemarkEmbedOptions | null | undefined)? ], Root>; //# sourceMappingURL=plugin.d.ts.map