This is a small cli utility when given a markdown file, the cli will parse it and create table of contents.
Usage is pretty straight forward. Call the utility with the location of the markdown you wish to add table of contents to. If you ever get stuck or forget which commands are available --help
will print them out.
Generate table of contents in a markdown file
USAGE:
mdtoc --input-file <INPUT_FILE>
OPTIONS:
-h, --help Print help information
-i, --input-file <INPUT_FILE> Location of the markdown file
-V, --version Print version information
Example
mdtoc --input-file README.md
# Shorthand
mdtoc -i README.md
There is now an option to specify a line where the table of contents will be placed. Once the ToC is generated, it will have tags in the comments indicating a start and an end. It is safe to run mdtoc
utility many times on the same file. It will replace the text between the tags.
To specify where in the markdown file the table of contents should be generated, place the following comment:
<!-- [mdtoc:start] -->
After you generate the table of contents you should see a starting and an ending tag wrapping the newly generated table. It is very important that you do not remove the ending tag otherwise running the mdtoc
utility will not yield the desired output.
<!-- [mdtoc:start] -->
...Generated Table of Contents...
<!-- [mdtoc:end] -->
As of the latest changes to the README, there isn't an official release candidate binary available for download. In order to get this working on your system, follow the instruction below.
- Rust
1.62.X
- Clone this repository to a local hard drive
git clone git@github.com:VeprUA/mdtoc.git
. - Step into the repository
cd mdtoc
. - Run
cargo build --release
. This will create a binary in thetarget/release/
directory.
Status | Description | Issue |
---|---|---|
✔️ | Generates table of contents at the top of the markdown file. | |
✔️ | Generating table of contents in a specific location of the documents. | #1 |
Escaping unsupported characters and input validation. | #2 | |
Support for stdin . |
#3 | |
CI/CD Configuration. | #4 | |
Support for watch mode. |
#6 |