A plugin for PostHTML to render markdown file into html.
Differences from other PostHTML markdown plugins
- markdown-it is used instead of marked
- a dash is included in the element name
<posthtml-md>
, which follows the naming convention of custom element
yarn add --dev @nonbili/posthtml-md-element
HTML
<body>
<posthtml-md src="docs/element.html"></posthtml-md>
</body>
NodeJS
posthtml()
.use(require("@nonbili/posthtml-md-element")())
.process(html)
.then((result) => console.log(result.html))
Or postcss.config.js
module.exports = {
plugins: {
"@nonbili/posthtml-md-element": {
}
}
}
root
: root path. Default to./
encoding
: default toutf-8
withMd
: a function(md: MarkdownIt) => ()
to further customize MarkdownIt.
All other options are passed to markdown-it.