This adds a table of contents generator.
It's based on #106 (and includes it in-line).
Since the toc generator is purely ast-based, we simply insert it into our own ast transformation pipeline.
This bypasses the cost of re-parsing, which is typically O(n^4), and makes it near-free when disabled.
This also adds some configurability on the user-end.
The toc frontmatter can have the values "true", "false", or an integer.
True is equivalent to 0, false to -1, and values >0 are translated to a maxheading of the value +1 (to account for titles being level 2).
This adds a table of contents generator. It's based on #106 (and includes it in-line).
Since the toc generator is purely ast-based, we simply insert it into our own ast transformation pipeline. This bypasses the cost of re-parsing, which is typically O(n^4), and makes it near-free when disabled.
This also adds some configurability on the user-end. The toc frontmatter can have the values "true", "false", or an integer. True is equivalent to 0, false to -1, and values >0 are translated to a maxheading of the value +1 (to account for titles being level 2).