markdown-it-book-plugin

3.10.1 • Public • Published

markdown-it-book-plugin


A markdown-it plugin for book or thesis writers.

Features

  • [x] Auto numbered images
  • [x] Auto numbered tables
  • [x] Auto numbered headings
  • [x] Auto numbered images made by mermaid source code

Installation

yarn add markdown-it-book-plugin

Usage

Basic:

const MarkdownIt = require("markdown-it");
const md = new MarkdownIt();

md.use(require('markdown-it-book-plugin'));

Advanced with options

If you want to prepend the chapter number to the heading, you can use the following options:

const MarkdownIt = require("markdown-it");
const md = new MarkdownIt();

md.use(require('markdown-it-book-plugin'), {
    mainCounterTag: 'h3',
    updateMainCounter: true,
});

You can even customize the counter for each heading, for example, skip the first two chapters:

const MarkdownIt = require("markdown-it");
const md = new MarkdownIt();

md.use(require('markdown-it-book-plugin'), {
    mainCounterTag: 'h3',
    updateMainCounter: ['', '', 1, 2, 3, 4],
});

More examples see

Who is using?

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'feat: add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request :D

💵 Questions

Feel free to contact me, I'd love to help.

向我咨询

Readme

Keywords

none

Package Sidebar

Install

npm i markdown-it-book-plugin

Weekly Downloads

6

Version

3.10.1

License

ISC

Unpacked Size

1.22 MB

Total Files

44

Last publish

Collaborators

  • jeff-tian