markdown-it-head-attr

1.0.5 • Public • Published

plugin for markdown-it markdown parser,add heading attr id and class

Install

node.js:

npm install markdown-it-head-attr --save

API

var md = require('markdown-it')()
var headAttr = require('markdown-it-head-attr')
 
md.use(headAttr)

Example:

  • add class
var str = '### Hello World {.head-class}'
var md = require('markdown-it')()
var headAttr = require('markdown-it-head-attr')
 
md.use(headAttr)
md.render()  //<h3 class="head-class">Hello World</h3>
  • add Id
var str = '### Hello World {#head-id}'
var md = require('markdown-it')()
var headAttr = require('markdown-it-head-attr')
 
md.use(headAttr)
md.render()  //<h3 id="head-id">Hello World</h3>

License

MIT

Package Sidebar

Install

npm i markdown-it-head-attr

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

2.98 kB

Total Files

4

Last publish

Collaborators

  • chenille