Only ATX-style headings are supported in md-toc.

cmark, github, gitlab

The code used in md-toc is a reverse engineering of the behavour described in the following:

The escape character \ will be left as-is since they are parsed by Github’s markdown parser already:

A line ending character is U+000A or the U+000D character, respectively \n and \r (or \r\n if combined). Everything following those characters is ignored. This has also the benefit to automatically remove the trailing newline or carriage return at the end of each line. This also includes ATX headers with line endings only as main content, such as #\n or #\r. See also:

Every other rule for ATX headings is applied.


Line endings are generically \n or \r characters. See: