Ox Content

youtube.ts

Source

getAttribute

function

Get element attribute value.

Source

function getAttribute(el: Element, name: string): string | undefined

Returns

string | undefined -


extractVideoId

function

Extract YouTube video ID from various URL formats.

Source

export function extractVideoId(input: string): string | null

Returns

string | null -


buildEmbedUrl

function

Build YouTube embed URL with parameters.

Source

function buildEmbedUrl(
  videoId: string,
  options: Required<YouTubeOptions>,
  params?: Record<string, string>,
  ): string

Returns

string -


createYouTubeElement

function

Create YouTube embed element.

Source


rehypeYouTube

function

Rehype plugin to transform YouTube components.

Source

function rehypeYouTube(options: Required<YouTubeOptions>)

transformYouTube

function

Transform YouTube components in HTML.

Source

export async function transformYouTube(html: string, options?: YouTubeOptions): Promise<string>

Returns

Promise<string> -