markedtoc

1.2.0 • Public • Published

markedtoc

Based on https://github.com/chjj/marked, but add support for table of content, and real-time preview via browser.

Table of content is generated from the headings that follow the TOC marker. See README.md.html for example.

Installation

Install nodejs

Then run command:

npm install -g markedtoc

Usage

The library usage is exactly the same as that of marked.

To use the TOC support, do the following:

  • Insert <TOC/> in the markdown file to generate table of content in the html output.
  • Insert <TOC numbered/> in the markdown file to generate table of content with numbered prefix.

Command line

To generate clean html to stdout:

mtoc README.md

To live preview file via default styled html in browser in real time:

mtoc -v README.md

To save a copy of preview html:

mtoc -s README.md

README.md.html will be created in the same directory as README.md.  Old README.md.xml is overwritten without
warning!

To preview file in browser, and save a copy of preview html every time 'README.md' changes:

mtoc -v -s README.md

To preview in browser using W3C working-draft style:

mtoc -v README.md --css http://www.w3.org/StyleSheets/TR/W3C-WD.css

Package Sidebar

Install

npm i markedtoc

Weekly Downloads

0

Version

1.2.0

License

ISC

Last publish

Collaborators

  • mhzed