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?
- https://identity.jefftian.dev/main.html
- Add yours here by submitting a PR
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.