Module: convert_util

Utility functions used by the convert.

Author:
  • Charles Karpati
Source:

Methods

(static) convertNotes(str) → {string}

Converts special note syntax in a string to HTML elements for displaying notes.

Parameters:
Name Type Description
str string

The string containing note syntax to be converted.

Source:
Returns:

The string with note syntax converted to HTML elements.

Type
string

(static) makeDetails(content, open) → {string}

Creates an HTML details element with the given content. Called by processOutput and processSource.

Parameters:
Name Type Description
content string

The HTML content to be placed inside the details tag.

open boolean

Determines if the details should be open by default.

Source:
Returns:

An HTML string representing a details element.

Type
string

(static) replaceAndLog(text, input, output) → {string}

Replaces occurrences of a pattern in a string and optionally logs the replacement.

Parameters:
Name Type Description
text string

The text in which replacements are to be made.

input RegExp | string

The pattern to search for in the text.

output function | string

The replacement text or a function that returns the replacement text.

Source:
Returns:

The text after performing the replacements.

Type
string

(static) replaceEmojis(text) → {string}

Replaces specified emoji characters in the text with their corresponding HTML entities. Convert emojis to html entities

Parameters:
Name Type Description
text string

The text containing emojis to be replaced.

Source:
Returns:

The text with emojis replaced by HTML entities.

Type
string