Generates table of contents for markdown files inside local git repository. Links are compatible with anchors generated by github or other sites via a command line flag.
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --gitlab
Original repository of DocToc:
Table of Contents:
Go into the directory that contains you local git project and type:
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc
This will update all markdown files in the current directory and all its subdirectories with a table of content that will point at the anchors generated by the markdown parser. Doctoc defaults to using the github parser, but you can use doctoc to generate links compatible with other sites
In order to add a table of contents whose links are compatible other sites add the appropriate mode flag:
Available modes are:
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --bitbucket bitbucket.org
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --nodejs nodejs.org
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --github github.com
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --gitlab gitlab.com
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --ghost ghost.org
If you already have a TOC inserted by doctoc, it will automatically be updated by running the command (rather than inserting a duplicate toc). Doctoc locates the TOC by the <!-- START doctoc -->
and <!-- END doctoc -->
comments, so you can also move a generated TOC to any other portion of your document and it will be updated there.
If you want to convert only specific files, do:
docker run --entrypoint doctoc --rm -it -v /path/to/dir:/usr/src jorgeandrada/doctoc file.md --notitle
docker run --entrypoint doctoc --rm -it -v /home/monino/Git/doctoc/:/usr/src jorgeandrada/doctoc README.md --notitle
You can print to stdout by using the -s
or --stdout
option.
docker run --rm -it -v $(pwd):/usr/src jorgeandrada/doctoc --github --stdout
DocToccing "." and its sub directories for github.com.
Found README.md in "."
==================
- [Docker DocToc](#docker-doctoc)
- [Adding toc to all files in a directory and sub directories](#adding-toc-to-all-files-in-a-directory-and-sub-directories)
- [Update existing doctoc TOCs effortlessly](#update-existing-doctoc-tocs-effortlessly)
- [Adding toc to individual files](#adding-toc-to-individual-files)
- [Printing to stdout](#printing-to-stdout)
==================
"README.md" should be updated
Everything is OK.