All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased version are marked with Plan for ${version}
or Unreleased
.
md_toc.exceptions.CannotTreatUnicodeString
exception.md_toc.TocDoesNotRenderAsCoherentList
exception is raised for big inputs
(>= 50M characters) when using the benchmark script.Add code fence detection before writing TOC in place. Until version 8.2.0, given for example a file like this
```
<!--TOC_MARKER-->
```
# ONE
## TWO
# ONE
## TWO
### THREE
running
md_toc --toc-marker '<!--TOC_MARKER-->' -p github file.md
results in
```
<!--TOC_MARKER-->
- [ONE](#one)
- [TWO](#two)
- [ONE](#one-1)
- [TWO](#two-1)
- [THREE](#three)
<!--TOC_MARKER-->
```
# ONE
## TWO
# ONE
## TWO
### THREE
instead of
```
<!--TOC_MARKER-->
```
# ONE
## TWO
# ONE
## TWO
### THREE
This means that if a TOC marker is detected within fenced code block it must be ignored. A similar problem happens if there are two TOC markers, one of them being inside a fenced code block:
```
<!--TOC_MARKER-->
```
<!--TOC_MARKER-->
# ONE
## TWO
# ONE
## TWO
### THREE
using the previous command results in
```
<!--TOC_MARKER-->
- [ONE](#one)
- [TWO](#two)
- [ONE](#one-1)
- [TWO](#two-1)
- [THREE](#three)
<!--TOC_MARKER-->
<!--TOC_MARKER-->
```
<!--TOC_MARKER-->
# ONE
## TWO
# ONE
## TWO
### THREE
Using the new --diff
option enables md-toc to return 128
if the existing
TOC in a file is different from the newly generated one, instead of a normal
0
value. Some CI systems don’t allow modifying files in-place when running
pre-commit.
By returning something different than 0, the pre-commit pipeline fails so the
user gets notified that the TOC needs to be changed.
See issue #40: There are no diff unless we specify -p
.
Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
<!--TOC-->
) to be detected
as real TOC content that needs to be replaced.requirements-freeze.txt
file with pinned dependencies for the
development environment, computed from the requirements.txt
and
requirements-dev
files.pkg_resources
because they are deprecated.Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
ctypes
.setup.cfg
and pyproject.toml
.
setup.py
is now a dummy file.setup.cfg
.venv
and pip
commands.setup.py sdist
, setup.py bdist_wheel
)
with the build
module.Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
Until version 8.1.5, given for example a file like this
# ONE
## TWO
### THREE
### THREE
### THREE
## THREE
# ONE
running
md_toc github -l2 file.md
results in
- [ONE](#one)
- [TWO](#two)
- [THREE](#three)
- [ONE](#one-1)
instead of
- [ONE](#one)
- [TWO](#two)
- [THREE](#three-3)
- [ONE](#one-1)
Note the -l2
option.
md-toc works fine if you use the maximum header level (typically 6).
Add a visible
key in the returned struct
of the
md_toc.api.get_atx_heading
function so that correct duplicate header counts
can be performed. This means that in cases of non
maximum header level selection (typically < 6) using the
-l [{1,2,3,4,5,6}], --header-levels [{1,2,3,4,5,6}]
option, all headers
must be parsed even if they are not visible in the end.
Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
< ... >
).
See issue #25.Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
md_toc.exceptions.CannotTreatUnicodeString
exception.
This exception will be removed in version 9 of md-toc.Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
Ported missing code changes from cmark 0.29 to 0.30.
Note: GitHub Flavored Markdown is still at version 0.29. md-toc does its best to support both GFM 0.29 and cmark 0.30.
Fixed issue 30: added full support for CommonMark 0.30.
Note:
cmark.py
.md_toc.api.get_md_header
and md_toc.api.get_atx_heading
now support
multiple lines.md_toc.exceptions.StringCannotContainNewlines
md_toc.exceptions.CannotTreatUnicodeString
md_toc.api.get_generic_fdr_indices
md_toc.api.get_fdr_indices
md_toc.api.can_open_emphasis
md_toc.api.can_close_emphasis
md_toc.api.get_nearest_list_id
back to software/md-toc