|markdownString||String of markdown source to be compiled.|
|options||Hash of options. Can also use |
|callback||Called when |
Alternative using reference
|baseUrl||0.3.9||A prefix url for any relative link.|
|breaks||v0.2.7||If true, add |
|gfm||v0.2.1||If true, use approved GitHub Flavored Markdown (GFM) specification.|
|headerIds||v0.4.0||If true, include an |
|headerPrefix||v0.3.0||A string to prefix the |
|highlight||v0.3.0||A function to highlight code blocks, see Asynchronous highlighting.|
|langPrefix||v0.3.0||A string to prefix the className in a |
|mangle||v0.3.4||If true, autolinked email address is escaped with HTML character references.|
|pedantic||v0.2.1||If true, conform to the original |
|renderer||v0.3.0||An object containing functions to render tokens to HTML. See extensibility for more details.|
|sanitize||v0.2.1||If true, sanitize the HTML passed into |
Warning: This feature is deprecated and it should NOT be used as it cannot be considered secure.
Instead use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML!
|sanitizer||v0.3.4||A function to sanitize the HTML passed into |
|silent||v0.2.7||If true, the parser does not throw any exception.|
|smartLists||v0.2.8||If true, use smarter list behavior than those found in |
|smartypants||v0.2.9||If true, use 'smart' typographic punctuation for things like quotes and dashes.|
|tokenizer||v1.0.0||An object containing functions to create tokens from markdown. See extensibility for more details.|
|walkTokens||v1.1.0||A function which is called for every token. See extensibility for more details.|
|xhtml||v0.3.2||If true, emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a '/' as required by XHTML.|
You can parse inline markdown by running markdown through
Js Markdown Wysiwyg Editor
pygmentize.js library uses asynchronous highlighting. This example demonstrates that marked is agnostic when it comes to the highlighter you use.
In both examples,
code is a
string representing the section of code to pass to the highlighter. In this example,
lang is a
string informing the highlighter what programming language to use for the
callback is the
function the asynchronous highlighter will call once complete.
Js Markdown Editor
To prevent ReDoS attacks you can run marked on a worker and terminate it when parsing takes longer than usual.
Marked can be run in a worker thread on a node server, or a web worker in a browser.
Node Worker Thread
Js Markdown To Pdf
Js Markdown Renderer
NOTE: Web Workers send the payload from
postMessage in an object with the payload in a