One of my biggest mistakes with this blog was not finding a WordPress plugin that would allow me to write my posts with markdown; to this day I still need to write posts in “Visual” mode and then. Create Markdown documents using JavaScript and Bootstrap themes # Strapdown.js Strapdown.js makes it embarrassingly simple to create elegant Markdown documents.No server-side compilation required. Cebe Markdown, Ciconia, Github Flavored Markdown, Kramdown, Markdown-it, Marked, Maruku, Multi-Markdown, Parsedown, PHP Markdown Extended, Python Markdown, Redcarpet, Remarkable, Showdown Metadata Some extensions will let you add meta data that you can use to add information that your app can parse like perhaps choosing a template or setting. Don't fix original markdown bugs or behavior. Turns off and overrides gfm. Renderer: object: new Renderer v0.3.0: An object containing functions to render tokens to HTML. See extensibility for more details. Sanitize: boolean: false: v0.2.1: If true, sanitize the HTML passed into markdownString with the sanitizer function. Paste or type your markdown and see it rendered as HTML. Download or copy the resulting HTML.
The marked function
| Argument | Type | Notes | 
|---|---|---|
| markdownString | string | String of markdown source to be compiled. | 
| options | object | Hash of options. Can also use marked.setOptions. | 
| callback | function | Called when markdownStringhas been parsed. Can be used as second argument if nooptionspresent. | 
Alternative using reference
Options
| Member | Type | Default | Since | Notes | 
|---|---|---|---|---|
| baseUrl | string | null | 0.3.9 | A prefix url for any relative link. | 
| breaks | boolean | false | v0.2.7 | If true, add <br>on a single line break (copies GitHub behavior on comments, but not on rendered markdown files). Requiresgfmbetrue. | 
| gfm | boolean | true | v0.2.1 | If true, use approved GitHub Flavored Markdown (GFM) specification. | 
| headerIds | boolean | true | v0.4.0 | If true, include an idattribute when emitting headings (h1, h2, h3, etc). | 
| headerPrefix | string | ' | v0.3.0 | A string to prefix the idattribute when emitting headings (h1, h2, h3, etc). | 
| highlight | function | null | v0.3.0 | A function to highlight code blocks, see Asynchronous highlighting. | 
| langPrefix | string | 'language-' | v0.3.0 | A string to prefix the className in a <code>block. Useful for syntax highlighting. | 
| mangle | boolean | true | v0.3.4 | If true, autolinked email address is escaped with HTML character references. | 
| pedantic | boolean | false | v0.2.1 | If true, conform to the original markdown.plas much as possible. Don't fix original markdown bugs or behavior. Turns off and overridesgfm. | 
| renderer | object | new Renderer() | v0.3.0 | An object containing functions to render tokens to HTML. See extensibility for more details. | 
| sanitize | boolean | false | v0.2.1 | If true, sanitize the HTML passed into markdownStringwith thesanitizerfunction.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 | function | null | v0.3.4 | A function to sanitize the HTML passed into markdownString. | 
| silent | boolean | false | v0.2.7 | If true, the parser does not throw any exception. | 
| smartLists | boolean | false | v0.2.8 | If true, use smarter list behavior than those found in markdown.pl. | 
| smartypants | boolean | false | v0.2.9 | If true, use 'smart' typographic punctuation for things like quotes and dashes. | 
| tokenizer | object | new Tokenizer() | v1.0.0 | An object containing functions to create tokens from markdown. See extensibility for more details. | 
| walkTokens | function | null | v1.1.0 | A function which is called for every token. See extensibility for more details. | 
| xhtml | boolean | false | v0.3.2 | If true, emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a '/' as required by XHTML. | 

Inline Markdown
You can parse inline markdown by running markdown through marked.parseInline.

Asynchronous highlighting
Unlike highlight.js the 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 code and callback is the function the asynchronous highlighter will call once complete.

Workers
Js Markdown To Html Download
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 Html Online
Web Worker
NOTE: Web Workers send the payload from postMessage in an object with the payload in a .data property
