Automatically generate a table of contents for a markdown file to improve document readability.
Description
The table of contents generated by this program is designed to work with several markdown parsers such as the one used by GitHub and GitLab.
When used with the in-place option this script will write the table of contents at the first occurrency of a marker. The default marker is [](TOC) which will result as invisible when reading the parsed markdown file.
By default, titles up to three indentation levels (in HTML: h1, h2, h3) will be included in the table of contents.
As a final remark, it is possible to generate an ordered and an unordered table of contents. In both cases, each element of the toc is by default a clickable link to a paragraph in the page. It is also possible to generate non-linked version of the TOC.
Video
Documentation
http://frnmst.github.io/md-toc
Please read carefully the Markdown specification section of the documentation to learn how this program parsers markdown files.
Conventions
PEP.
4 space indentation.
Help
usage: md_toc [-h] [-i] [-n] [-o] [-p {standard,github,redcarpet,gitlab}]
[-t TOC_MARKER] [-l HEADER_LEVELS] [-v]
FILE_NAME
Markdown Table Of Contents
positional arguments:
FILE_NAME the I/O file name
optional arguments:
-h, --help show this help message and exit
-i, --in-place overwrite the input file
-n, --no-links avoids adding links to corresponding content
-o, --ordered write as an ordered list
-p {standard,github,redcarpet,gitlab}, --parser {standard,github,redcarpet,gitlab}
decide what markdown parser will be used to generate
the links. Defaults to standard
-t TOC_MARKER, --toc-marker TOC_MARKER
set the string to be used as the marker for
positioning the table of contents
-l HEADER_LEVELS, --header-levels HEADER_LEVELS
set the maximum level of headers to be considered as
part of the TOC
-v, --version show program's version number and exit
Return values: 0 OK, 1 Error, 2 Invalid command
License
Copyright (C) 2017-2018 frnmst (Franco Masotti) <franco.masotti@live.com> <franco.masotti@student.unife.it>
md-toc is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
md-toc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with md-toc. If not, see <http://www.gnu.org/licenses/>.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md_toc-1.0.0.tar.gz.
File metadata
- Download URL: md_toc-1.0.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1011688fd56546d35a55b99ce9ee165095222acee0f49c77a52f399cdd90f2c0
|
|
| MD5 |
23c7e454d9289da6c619b131ae44402c
|
|
| BLAKE2b-256 |
42f9f32947ecfb6fba2f996c763f290c1d9cc6a2494edb3538f6b8f49b965e65
|
File details
Details for the file md_toc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: md_toc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e9d14fbb305702674c1d6dec481d2d572c8c009a7eddce446beeb33df0efd63
|
|
| MD5 |
d41f13be0b3cf1142d53a8e55adce9b5
|
|
| BLAKE2b-256 |
f234420c955028c8b93be40ecb45f797fcc79eb096168658ecfb0d04fec7f667
|