metalsmith-robotskirt
A Metalsmith plugin to convert markdown files with Robotskirt, a node wrapper for Sundown.
Installation
$ npm install metalsmith-robotskirt
CLI Usage
Install via npm and then add the metalsmith-robotskirt key to your metalsmith.json with any options you want, like so:
Javascript Usage
Pass options to the plugin and pass it to Metalsmith with the use method:
var robotskirt = ;metalsmith;
Options
All options are optional...
Defaults
var defaults =extensions:autolink: truefenced_code: truelax_spacing: trueno_intra_emphasis: truespace_headers: truestrikethrough: truesuperscript: truetables: truehtmlFlags:skip_html: falseskip_style: falseskip_images: falseskip_links: falsesafelink: falsetoc: falsehard_wrap: falseuse_xhtml: falseexpand_tabs: falseescape: falserenderers:blockcode: highlightCodeBlockssmartypants: true;
Extensions
-
autolink
Parse links even when they are not enclosed in<>
characters. Autolinks for the http, https and ftp protocols will be automatically detected. Email addresses are also handled, and http links without protocol, but starting withwww.
-
fenced_code
Parse fenced code blocks, PHP-Markdown style. Blocks delimited with 3 or more~
or backticks will be considered as code, without the need to be indented. An optional language name may be added at the end of the opening fence for the code block -
lax_spacing
HTML blocks do not require to be surrounded by an empty line as in the Markdown standard. -
no_intra_emphasis
Do not parse emphasis inside of words. Strings such asfoo_bar_baz
will not generate<em>
tags. -
space_headers
A space is always required between the hash at the beginning of a header and its name, e.g.#this is my header
would not be a valid header. -
strikethrough
Parse strikethrough, PHP-Markdown style. Two~
characters mark the start of a strikethrough, e.g.this is ~~good~~ bad
-
superscript
Parse superscripts after the^
character; contiguous superscripts are nested together, and complex values can be enclosed in parenthesis, e.g.this is the 2^(nd) time
-
tables
Parse tables, PHP-Markdown style
HTML Flags
-
skip_html
Do not allow any user-inputted HTML in the output. -
skip_images
Do not generate any<img>
tags. -
skip_links
Do not generate any<a>
tags. -
skip_style
Do not generate any<style>
tags. -
safelink
Only generate links for protocols which are considered safe. -
toc
Add HTML anchors to each header in the output HTML, to allow linking to each section. -
hard_wrap
Insert HTML<br>
tags inside on paragraphs where the origin Markdown document had newlines (by default, Markdown ignores these newlines). -
use_xhtml
Output XHTML-conformant tags. -
expand_tabs
-
escape
Renderers
You can define your own renderers like this:
var robotskirt =highlightjs = ;{var validLang = lang && highlightjshighlightedCode = validLang ? highlightjsvalue : highlightjsvaluelangClass = validLang ? ' class="lang-' + lang + '"' : '';return '<pre><code' + langClass + '>' + highlightedCode + '</code></pre>';}metalsmith;