Enumerate headers in markdown file.
Run from the command line
markdown-enum inputFile.md outputFile.md
The script will parse someFile.md
, add an enumeration to each header and output
the result to the file named outputFile.md
.
All previously existing headers will be overriden. So a useful scenario is
markdown-enum inputFile.md inputFile.md
Requires python 3.
pip install enumerate-markdown
The markdown syntax assumed is the one used by mistune, called "Sane CommonMark"
https://mistune.readthedocs.io/en/latest/intro.html#sane-commonmark
But, with a fine twist: headings defined by a single -
or single =
are considered too. For example:
This is a heading
-
This is also a heading
=