Provides access to Markdown-related functions.
- Source:
Members
breaks
- Source:
breaks
- Source:
classString
- Source:
classString
- Source:
env
- Source:
highlight
- Source:
highlighter
- Source:
highlighter
- Source:
highlighter
- Source:
highlighter
- Source:
highlighter
- Source:
highlighter
- Source:
highlighterPath
- Source:
html
- Source:
langClass
- Source:
logger
- Source:
MarkdownIt
- Source:
marked
- Source:
mda
- Source:
parserNames :String
Enumeration of Markdown parsers that are available.
Type:
- String
Properties:
| Name | Type | Description |
|---|---|---|
evilstreak |
String | The [`markdown-js`](https://github.com/evilstreak/markdown-js) (aka "evilstreak") parser. |
gfm |
String | The "GitHub-flavored Markdown" parser. |
markdownit |
String | The `markdown-it` parser. |
marked |
String | The [Marked](https://github.com/chjj/marked) parser. |
- Source:
path
- Source:
renderer
- Source:
renderer
- Source:
renderer
- Source:
result
- Source:
result
- Source:
result
- Source:
result
- Source:
result
- Source:
result
- Source:
source
- Source:
source
- Source:
source
- Source:
source
- Source:
Methods
getParser() → {function}
Retrieve a Markdown parsing function based on the value of the `conf.json` file's
`env.conf.markdown` property. The parsing function accepts a single parameter containing Markdown
source. The function uses the parser specified in `conf.json` to transform the Markdown source to
HTML, then returns the HTML as a string.
- Source:
Returns:
A function that accepts Markdown source, feeds it to the selected parser, and
returns the resulting HTML.
- Type
- function
escapeCode(source) → {string}
Escape characters in text within a code block.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to escape. |
- Source:
Returns:
The escaped source text.
- Type
- string
escapeInlineTagBackslashes(source) → {string}
Escape backslashes within inline tags so that they are not stripped.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to escape. |
- Source:
Returns:
The source text with backslashes escaped within inline tags.
- Type
- string
escapeUnderscores(source) → {string}
Escape underscores that occur within an inline tag in order to protect them from the `marked`
parser.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to sanitize. |
- Source:
Returns:
The source text, where underscores within inline tags have been protected with a
preceding backslash (e.g., `\_`). The `marked` parser will strip the backslash and protect the
underscore.
- Type
- string
escapeUrls(source) → {string}
Escape HTTP/HTTPS URLs so that they are not automatically converted to HTML links.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to escape. |
- Source:
Returns:
The source text with escape characters added to HTTP/HTTPS URLs.
- Type
- string
getHighlighter(conf) → {function}
Get the appropriate function for applying syntax highlighting to text, based on the user's
Markdown configuration settings.
Parameters:
| Name | Type | Description |
|---|---|---|
conf |
Object | The user's Markdown configuration settings. |
- Source:
Returns:
The highlighter function.
- Type
- function
getParseFunction(parserName, confopt) → {function}
Retrieve a function that accepts a single parameter containing Markdown source. The function uses
the specified parser to transform the Markdown source to HTML, then returns the HTML as a string.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
parserName |
String | The name of the selected parser. | |
conf |
Object |
<optional> |
Configuration for the selected parser, if any. |
- Source:
Returns:
A function that accepts Markdown source, feeds it to the selected parser, and
returns the resulting HTML.
- Type
- function
highlight(code, languagenullable) → {string}
Wrap a code snippet in HTML tags that enable syntax highlighting.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
code |
string | The code snippet. | |
language |
string |
<nullable> |
The language of the code snippet. |
- Source:
Returns:
The wrapped code snippet.
- Type
- string
parserFunction()
- Source:
parserFunction()
- Source:
unencodeQuotes(source) → {string}
Unencode quotes that occur within {@ ... } after the Markdown parser has turned them into HTML
entities.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to unencode. |
- Source:
Returns:
The source text with HTML entity `"` converted back to standard quotes.
- Type
- string
unescapeUrls(source) → {string}
Unescape HTTP/HTTPS URLs after Markdown parsing is complete.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | The source text to unescape. |
- Source:
Returns:
The source text with escape characters removed from HTTP/HTTPS URLs.
- Type
- string