Skip to content

youtube.ts#

View Markdown

Source

3 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

3 symbols 2 functions 1 modules 3 parameters 2 returns

Reference#

fnextractVideoId(input: string): string | nullExtract a YouTube video ID from a bare ID or a watch / share / embed / shorts U…

Extract a YouTube video ID from a bare ID or a watch / share / embed / shorts URL.

The rule lives in Rust so this function and the <youtube> rewrite below cannot disagree about what counts as a video: transformYoutubeEmbeds resolves IDs with the same code.

Signature

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

View source

Parameters

  • input string

Returns

string | null
fntransformYouTube(html: string, options?: YouTubeOptions): Promise<string>Transform YouTube components in HTML.

Transform YouTube components in HTML.

Signature

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

View source

Parameters

  • html string
  • options YouTubeOptions

    optional

Returns

Promise<string>
moduleyoutubeYouTube Plugin - Privacy-enhanced iframe embedding Transforms <YouTube> components into responsive iframe embeds using…

YouTube Plugin - Privacy-enhanced iframe embedding

Transforms <YouTube> components into responsive iframe embeds using youtube-nocookie.com for enhanced privacy. A digits-only start attribute becomes ?start= on the iframe URL.

The HTML rewrite is performed in Rust (transformYoutubeEmbeds in

View source