- Number headings in markdown files:
- Before:
# society ## politics ## economics # to do # academic ## math ## physics # language ## japanese ## english ## french
- After:
# 1 society ## 1.1 politics ## 1.2 economics # 2 to do # 3 academic ## 3.1 math ## 3.2 physics # 4 language ## 4.1 japanese ## 4.3 english ## 4.4 french
- Before:
- Make tables of contents in markdown files
- Before:
Title === # 1 society ## 1.1 politics ## 1.2 economics # 2 to do # 3 academic ## 3.1 math ## 3.2 physics # 4 language ## 4.1 japanese ## 4.3 english ## 4.4 french
- After:
Title === <!-- Table of contents --> - [1 society](#1-society) - [1.1 politics](#1.1-politics) - [1.2 economics](#1.2-economics) - [2 to do](#2-to-do) - [3 academic](#3-academic) - [3.1 math](#3.1-math) - [3.2 physics](#3.2-physics) - [4 language](#4-language) - [4.1 japanese](#4.1-japanese) - [4.3 english](#4.3-english) - [4.4 french](#4.4-french) <!-- Table of contents --> # 1 society ## 1.1 politics ## 1.2 economics # 2 to do # 3 academic ## 3.1 math ## 3.2 physics # 4 language ## 4.1 japanese ## 4.3 english ## 4.4 french
- Before:
-
numbering.py
will number headings in all markdown files in the directory.python numbering.py add /path/to/directory
add
: add numbers to headingsremove
: remove numbers from headingsupdate
: update numbers
-
toc.py
will add tables of contents to all markdown files in the directory.python toc.py add /path/to/directory
add
: add tables of contentsremove
: remove tables of contentsupdate
: update tables of contents
This script assumes that the title is written in the first line using ===
as follows.
Title
===
# heading1
## heading1.1
## heading1.2
# heading2
## heading2.1
## heading2.2
The table of contents will be added below the title between <!-- Table of contents -->
and <!-- Table of contents -->
.