A Metalsmith plugin to convert markdown files.
$ npm install metalsmith-markdown
Install via npm and then add the metalsmith-markdown
key to your metalsmith.json
plugins with any Marked options you want, like so:
{
"plugins": {
"metalsmith-markdown": {
"smartypants": true,
"gfm": true,
"tables": true
}
}
}
Pass options
to the markdown plugin and pass it to Metalsmith with the use
method:
var markdown = require('metalsmith-markdown');
metalsmith.use(markdown({
smartypants: true,
gfm: true,
tables: true
}));
If you'd like to use markdown in your frontmatter, just specify which keys you'd like to convert.
metalsmith.use(markdown({
keys: ['text']
}));
Now nothing stops you to use markdown in your frontmatter.
---
custom: _a_
---
Body
If you'd like to set file specific markdown options, you can achieve that
with the useMetadata
option set to true
.
metalsmith.use(markdown({
useMetadata: true
}));
Now you can pass options to the markdown converter by specifying them in your frontmatter.
---
gfm: false
---
~~Mistaken text.~~
Even options in your global metalsmith metadata will be passed to the markdown converter. This way you can specify specific markdown options for a subtree.
MIT