UNPKG

lexical-remark

Version:

This package contains Markdown helpers and functionality for Lexical using remark-parse.

23 lines (22 loc) 837 B
import { Root } from 'mdast'; import { Plugin } from 'unified'; /** * A regular expression to detect a YouTube url and parse out the video id as the sixth capture group * * @example * function getVideoId(value: string) { * const match = value.match(YOUTUBE_URL_REGEX); * return !!match ? match[6] : null; * } */ export declare const YOUTUBE_URL_REGEX: RegExp; /** * A remark plugin to enrich an mdast node tree by converting paragraph nodes containing only a YouTube url into YouTube nodes */ export declare const remarkYoutube: Plugin<[], string, Root>; /** * A remark plugin to simplify an mdast node tree by converting YouTube nodes back to paragraph nodes */ export declare function youtubeRemark(this: any): typeof convertToYoutubeParagraphs; declare function convertToYoutubeParagraphs(tree: any): void; export {};