Include markdown files into your reshape templates
npm install reshape-markdown


A parser for the reshape include plugin that allows you to include markdown files into your HTML, uses the [markdown-it][] parser by default.
---
- Install
- Usage
- Options
- License
---
``shell`
npm i --save reshape-markdown
Given an index.html such as:
` Partial: after the partialhtml`
And a _partial.md file like:
`markdown`
hello from the partial!
You can process them with [reshape][]:
`javascript
const {readFileSync} = require('fs')
const reshape = require('reshape')
const include = require('reshape-include')
const markdown = require('reshape-markdown')
const html = readFileSync('docs/readme/index.html')
reshape({
plugins: [
include({
parserRules: [
{
test: /\.md$/,
parser: markdown()
}
]
})
]
})
.process(html)
.then((result) => console.log(result.output()))
`
Generates the output:
` Partial: hello from the partial! after the partialhtml
`
* parser: Markdown parser, must expose a render() function.markdown`: Options to pass when instantiating the [markdown-it][] instance.
*
MIT
---
Created by mkdoc on February 20, 2017
[makestatic]: https://makestatic.ws
[mkdoc]: https://github.com/mkdoc/mkdoc
[reshape]: https://reshape.ml
[markdown-it]: https://github.com/markdown-it/markdown-it