Difference between revisions of "Md-toc"

From Free Software Directory
Jump to: navigation, search
(Updated version.)
(Updated version.)
Line 2: Line 2:
 
|Name=md-toc
 
|Name=md-toc
 
|Short description=Automatically generate a compliant table of contents for a markdown file to improve document readability
 
|Short description=Automatically generate a compliant table of contents for a markdown file to improve document readability
|Full description=The table of contents (a.k.a: TOC) generated by this program is designed to
+
|Full description===Description==
work with several markdown parsers such as the ones used by GitHub and GitLab.
 
  
When used with the in-place option this script will write the TOC at the first
+
The table of contents (a.k.a: TOC) generated by this program is designed to work with several markdown parsers such as the ones used by GitHub and GitLab.
occurrency of a marker. The default marker is ``<!--TOC-->``, which, being
 
an HTML comment, will result invisible after the markdown file has
 
been translated.
 
  
By default titles up to three indentation levels (in HTML: ``h1``, ``h2``,
+
Rules for generating the TOC are determined by the selected markdown parser. md-toc aimes infact to be as conformant as possible in respect to each one of them. This was possible by studying the available documentations and by reverse engineering the source codes.
``h3``) will be included in the TOC but the user can decide to keep all
 
possible levels.
 
  
md_toc makes it is possible to generate ordered and unordered TOCs.
+
GitHub and GitLab have introduced their version of the markdown TOC after md-toc and similar tools were created:
In both cases each element of the TOC is by default a
+
* in March 2021 GitHub added an interactive TOC button at the top-left of readme files. This system works for markdown and others
link to a paragraph in the web page. It is also possible to generate
+
* GitLab added an extension called Table of contents to its Gitlab Flavored Mardown
a non-linked version of the TOC.
 
  
If the user wants it, there is the possibility to ignore space indentations
+
==Features==
within the TOC and to skip an initial number of lines from the markdown file.
 
  
Rules for generating the TOC are determined by the selected
+
* works offline
markdown parser. md-toc aimes infact to be as conformant as possible in
+
* edits file in place using a TOC marker (default `<!--TOC-->`) or
respect to each one of them. This was possible by studying the available
+
  output to standard output
documentations and by reverse engineering the source codes.
+
* selection of indentation level
 +
* list indentation based on heading, which can optionally be disabled
 +
* outputs an ordered or unordered TOC list
 +
* creates anchor links to markdown headings by default or a plain list
 +
  as alternative
 +
* checks if heading level is coherent: this avoid creating an
 +
  erroneous TOC. This feature can be disabled if needed
 +
* skip any number lines before generating the TOC
 +
* can read content from standard input
 +
* handles multiple files at once
 +
* selection of newline string
 +
* selection of list marker
 +
* supports GitHub, GitLab, Commonmark, Redcarpet and others
 +
* pre-commit hook
 
|Homepage URL=https://blog.franco.net.eu.org/software/#md-toc
 
|Homepage URL=https://blog.franco.net.eu.org/software/#md-toc
|Version download=https://blog.franco.net.eu.org/software/md-toc-8.1.3/md-toc-8.1.3.tar.gz
+
|Version download=https://blog.franco.net.eu.org/software/md-toc-8.1.3/md-toc-8.1.4.tar.gz
 
}}
 
}}
 
{{Project license
 
{{Project license
Line 96: Line 101:
 
|Prerequisite kind=Required to build
 
|Prerequisite kind=Required to build
 
|Prerequisite description=sphinx-tabs
 
|Prerequisite description=sphinx-tabs
 +
}}
 +
{{Software prerequisite
 +
|Prerequisite kind=Weak prerequisite
 +
|Prerequisite description=pyfakefs
 
}}
 
}}
 
{{Person}}
 
{{Person}}
Line 140: Line 149:
 
|Donate=https://www.buymeacoffee.com/frnmst
 
|Donate=https://www.buymeacoffee.com/frnmst
 
|Keywords=markdown, md, table-of-contents, toc
 
|Keywords=markdown, md, table-of-contents, toc
|Version identifier=8.1.3
+
|Version identifier=8.1.4
|Version date=2022-04-20
+
|Version date=2022-06-15
 
|Version status=beta
 
|Version status=beta
|Version comment=- Added bracket support detection in emphasis for cmark. - Speed and memory improvements.
+
|Version comment=- Improved readme according to issue #36. - Improved TOC marker detection and TOC substitution in place.
 
|Last review by=Frnmst
 
|Last review by=Frnmst
|Last review date=2022-04-20
+
|Last review date=2022-06-17
 
|User level=intermediate
 
|User level=intermediate
 
|Component programs=Python 3
 
|Component programs=Python 3
 
|Accepts cryptocurrency donations=Yes
 
|Accepts cryptocurrency donations=Yes
|OpenPGP signature=https://blog.franco.net.eu.org/software/md-toc-8.1.3/md-toc-8.1.3.tar.gz.sig
+
|OpenPGP signature=https://blog.franco.net.eu.org/software/md-toc-8.1.4/md-toc-8.1.4.tar.gz.sig
 
|OpenPGP public key=https://blog.franco.net.eu.org/pubkeys/pgp_pubkey_since_2019.txt
 
|OpenPGP public key=https://blog.franco.net.eu.org/pubkeys/pgp_pubkey_since_2019.txt
 
|Test entry=No
 
|Test entry=No
 
}}
 
}}
 
{{Featured}}
 
{{Featured}}

Revision as of 17:21, 17 June 2022


[edit]

md-toc

https://blog.franco.net.eu.org/software/#md-toc
Automatically generate and add an accurate table of contents to markdown files.

Description

The table of contents (a.k.a: TOC) generated by this program is designed to work with several markdown parsers such as the ones used by GitHub and GitLab.

Rules for generating the TOC are determined by the selected markdown parser. md-toc aimes infact to be as conformant as possible in respect to each one of them. This was possible by studying the available documentations and by reverse engineering the source codes.

GitHub and GitLab have introduced their version of the markdown TOC after md-toc and similar tools were created:

  • in March 2021 GitHub added an interactive TOC button at the top-left of readme files. This system works for markdown and others
  • GitLab added an extension called Table of contents to its Gitlab Flavored Mardown

Features

  • works offline
  • edits file in place using a TOC marker or output to standard output
  • maximum heading level selection (1 to 6)
  • list indentation based on heading, which can optionally be disabled
  • outputs an ordered or unordered TOC list
  • creates anchor links to markdown headings by default or a plain list as alternative
  • checks if heading level is coherent: this avoid creating an erroneous TOC. This feature can be disabled if needed
  • skip any number lines before generating the TOC
  • can read content from standard input
  • handles multiple files at once
  • selection of newline string
  • check if there is difference between existing TOC in file and newly generated one
  • selection of list marker
  • supports GitHub, GitLab, Commonmark, Redcarpet and others
  • pre-commit md-toc hook

And more! See the feature comparison table

Documentation

Documentation at: https://docs.franco.net.eu.org/md-toc/

Related Projects






Entry
































"Python (Ref)" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Users" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property."Developers" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Users" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property."Developers" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Users" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property."Developers" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Users" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property."Developers" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Documentation" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.


"Users" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property."Developers" is not in the list (General, Help, Bug Tracking, Support, Developer) of allowed values for the "Resource audience" property.







Property "Submitted by" (as page type) with input value "{{{Submitted by}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. "{{{Submitted date}}}" contains an extrinsic dash or other characters that are invalid for a date interpretation.











Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the page “GNU Free Documentation License”.

The copyright and license notices on this page only apply to the text on this page. Any software or copyright-licenses or other similar notices described in this text has its own copyright notice and license, which can usually be found in the distribution or license text itself.