youtube.ts
getAttribute
function
Get element attribute value.
function getAttribute(el: Element, name: string): string | undefined
Returns
string | undefined -
extractVideoId
function
Extract YouTube video ID from various URL formats.
export function extractVideoId(input: string): string | null
Returns
string | null -
buildEmbedUrl
function
Build YouTube embed URL with parameters.
function buildEmbedUrl(
videoId: string,
options: Required<YouTubeOptions>,
params?: Record<string, string>,
): string
Returns
string -
createYouTubeElement
function
Create YouTube embed element.
rehypeYouTube
function
Rehype plugin to transform YouTube components.
function rehypeYouTube(options: Required<YouTubeOptions>)
transformYouTube
function
Transform YouTube components in HTML.
export async function transformYouTube(html: string, options?: YouTubeOptions): Promise<string>
Returns
Promise<string> -