PostHTML plugin render markdown inside html elements.
npm install posthtml-md2html[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Build][build]][build-badge]
[![Coverage][cover]][cover-badge]
[![Standard Code Style][style]][style-url]
[![Chat][chat]][chat-badge]
[posthtml-md2html] is a markdown plugin for [PostHTML] that lets you use markdown within HTML elements in an easy and intuitive way.
Main features:
- Works on any tag with a md or markdown property
- Knows when to write inline or block-level content
- Will replace element if tag is or
- Will treat pre tag with md or markdown property as tag
Before: | Head | row |
`` html`
|------|-----|
| Data | row |
> # Title
>
> This is blockquote paragraph
After:
` htmlHeading with italics
Bold paragraph
| Head | row |
|---|---|
| Data | row |
Title
This is blockquote paragraph
Install
`bash
npm i -S posthtml posthtml-md2html
`> Note: This project is compatible with node v10+
Usage
` js
const fs = require('fs');
const posthtml = require('posthtml');
const posthtmlPlugin = require('posthtml-md2html');posthtml()
.use(posthtmlPlugin({ / options / }))
.process(html/, options /)
.then(result => fs.writeFileSync('./after.html', result.html));
``All options are passed to marked directly
See PostHTML Guidelines and contribution guide.
[npm]: https://img.shields.io/npm/v/posthtml-md2html.svg
[npm-url]: https://npmjs.com/package/posthtml-md2html
[deps]: https://david-dm.org/posthtml/posthtml-md2html.svg
[deps-url]: https://david-dm.org/posthtml/posthtml-md2html
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
[style-url]: http://standardjs.com/
[build]: https://travis-ci.org/posthtml/posthtml-md2html.svg?branch=master
[build-badge]: https://travis-ci.org/posthtml/posthtml-md2html?branch=master
[cover]: https://coveralls.io/repos/posthtml/posthtml-md2html/badge.svg?branch=master
[cover-badge]: https://coveralls.io/r/posthtml/posthtml-md2html?branch=master
[chat]: https://badges.gitter.im/posthtml/posthtml.svg
[chat-badge]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"