Module: lib/elements

Methods

(static) markdownElements(markdown, optionsopt, nullable) → {*}

Generate an element model from a Markdown model.

Parameters:
Name Type Attributes Description
markdown Object

The Markdown model

options Object <optional>
<nullable>

The options object

Source:
Returns:

The Markdown's element model

Type
*

(static) markdownElementsAsync(markdown, optionsopt, nullable) → {*}

Generate an element model from a Markdown model.

This is the asynchronous form of the markdownElements function. Use this form of the function if you have one or more asynchronous code block functions.

Parameters:
Name Type Attributes Description
markdown Object

The Markdown model

options Object <optional>
<nullable>

The options object

Source:
Returns:

The Markdown's element model

Type
*

(static) markdownHeaderId(text) → {string}

Generate a Markdown header ID from text

Parameters:
Name Type Description
text string

The text

Source:
Returns:
Type
string

Type Definitions

CodeBlock

Type:
  • Object
Properties:
Name Type Attributes Description
language string <nullable>

The code block language

lines Array.<string>

The code blocks lines

startLineNumber number <optional>

The code blocks lines

Source:

CodeBlockFn(codeBlock, optionsnullable) → {*}

A code block render function

Parameters:
Name Type Attributes Description
codeBlock Object

The code block model

options Object <nullable>

The options object

Source:
Returns:

The code block's element model

Type
*

CopyFn(text)

A copy (to the clipboard) function

Parameters:
Name Type Description
text string

The text to copy

Source:

MarkdownElementsOptions

The markdownElements function's options object

Type:
  • Object
Properties:
Name Type Attributes Description
codeBlocks Object.<string, function()> <optional>

The code block render function map

copyFn function <optional>

The copy function. Copy links for fenced code blocks are only rendered when codeFn is present.

urlFn function <optional>

The URL modifier function

headerIds boolean <optional>

If true, generate header IDs

usedHeaderIds Set <optional>

Set of used header IDs

Source:

URLFn(url) → {string}

A URL modifier function

Parameters:
Name Type Description
url string

The URL

Source:
Returns:

The modified URL

Type
string