Fix: mdformat mkdocs compatibility#14
Conversation
This is problemetic when other plugins change how markdown is supposed to look, e.g. mdformat-mkdocs using 4 spaces for indentation.
ec7224c to
27d07b1
Compare
| toc += f"{indentation}- [{heading.text}]({uri})\n" | ||
|
|
||
| return toc | ||
| # Unlike code-formatters, parser_extensions are stored as a list without |
There was a problem hiding this comment.
@hukkin What do you think about using a dict for parser_extension, just like for code-formatters? That would make this a whole lot cleaner but requires a breaking change in mdformat. Current way is a rather ugly workaround.
|
@hukkin If you have some time, what do you think about the approach taken here? Happy make changes if needed, but i do think trying to render the toc with mdformat itself is the most robust way to deal with this. |
|
@hukkin I just wanted to bump this PR, as having this behavior would be very helpful. I am not using mkdocs, but I am using md2conf, which (through python-markdown) requires lists to be indented by 4 spaces. I'm currently using mdformat-space-control to set indentation for the file to 4 spaces, but the hard-coded spacing in mdformat-toc means that I'm not able to use it for now. |
See #12
Not entirely happy with what i had to do to determine the enabled parser extensions.