marksman
marksman copied to clipboard
Add indentation configuration
Ideally, marksman
should follow the indentation config of the editor (or currently open file or .editorconfig
), however, when that does not work, users should be able to configure indentation via, e.g., indent
property which could be either tab
string or a number (how many spaces should be used for indentation).
~~Now, I have configured indentation to three spaces in Markdown files, however, the generated TOC looks like this:~~ Actually, this was my mistake, as I actually used heading levels 1, 3, 4, and 3 instead of 1, 2, 3, 2).
example of my mistake
<!--toc:start-->
- [Heading 1]()
- [Heading 2]() <!-- 6 spaces -->
- [Heading 3]() <!-- 8 spaces -->
- [Heading 2]() <!-- 6 spaces -->
<!--toc:end-->
I would expect it to be as follows:
<!--toc:start-->
- [Heading 1]()
- [Heading 2]() <!-- 3 spaces -->
- [Heading 3]() <!-- 6 spaces -->
- [Heading 2]() <!-- 3 spaces -->
<!--toc:end-->
marksman
always uses two spaces for indentation. The relevant line from Marksman/Toc.fs
:
https://github.com/artempyanykh/marksman/blob/a511779d2d2ad8c3fdf060d62d4dfb723ed23e2b/Marksman/Toc.fs#L31
Thanks for raising this @tukusejssirs! Adding support for both would be helpful!
- indentation config in
.marksman.toml
and -
.editorconfig