Renders this markdown
# Header 1Text.### Header 2Lorem?## Header 3Ipsum.# Last headerMarkdown rules!
to this output (without indentation)
Header 1 Text. Header 2 Lorem? Header 3 Ipsum. Last header Markdown rules!
If you add attrs, anchor or any other plugin that adds attributes to header-tokens, sections will have the same attributes (which is useful for styling).
E.g., with attrs enabled before header-sections:
var md =
this markdown
# great stuff {.jumbotron}lorem click me {.btn .btn-default}
renders to
<section class="jumbotron"> <h1 class="jumbotron">great stuff</h1> <p>lorem</p> <p class="btn btn-default">click me</p></section>
Install
npm install markdown-it-header-sections
Usage
var md = ;md; var src = '# first header\n';src += 'lorem\n\n'src += '## second header\n';src += 'ipsum'; console;