Namespace: HTML5Media

HTML5Media

A minimalist markdown-it plugin for parsing video/audio references inside markdown image syntax as <video> / <audio> tags.

Source:

Methods

(static) guessMediaType(url) → {String}

Guess the media type represented by a URL based on the file extension, if any

Parameters:
Name Type Description
url String

any valid URL

Source:
Returns:

a type identifier: 'image' (default for all unrecognized URLs), 'audio' or 'video'

Type
String

(static) html5Media(md, optionsopt)

The main plugin function, exported as module.exports

Parameters:
Name Type Attributes Description
md MarkdownIt

instance, automatically passed by md.use

options Object <optional>

configuration

Properties
Name Type Attributes Default Description
videoAttrs String <optional>
'controls class="html5-video-player"'

attributes to include inside <video> tags

audioAttrs String <optional>
'controls class="html5-audio-player"'

attributes to include inside <audio> tags

messages MessagesObj <optional>
built-in messages

human-readable text that is part of the output

Source:

(static) renderMedia(tokens, idx, options, env, md) → {String}

Render tokens of the video/audio type to HTML5 tags

Parameters:
Name Type Description
tokens Object

token stream

idx Number

which token are we rendering

options Object

Markdown-It options, including this plugin's settings

env Object

Markdown-It environment, potentially including language setting

md MarkdownIt

instance used for utilities access

Source:
Returns:

rendered token

Type
String

(static) tokenizeImagesAndMedia(state, silent, md) → {Boolean}

A fork of the built-in image tokenizer which guesses video/audio files based on their extension, and tokenizes them accordingly.

Parameters:
Name Type Description
state Object

Markdown-It state

silent Boolean

if true, only validate, don't tokenize

md MarkdownIt

instance of Markdown-It used for utility functions

Source:
Returns:
Type
Boolean

(static) translate(language, messageKey, messageParams) → {String}

You can override this function using options.translateFn.

Parameters:
Name Type Description
language String

a language code, typically an ISO 639-[1-3] code.

messageKey String

an identifier for the message, typically a short descriptive text

messageParams Array.<String>

Strings to be substituted into the message using some pattern, e.g., %s or %1$s, %2$s. By default we only use a simple %s pattern.

Source:
Returns:

the translation to use

Type
String

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy