Skip to content

Fix: mdformat mkdocs compatibility#14

Open
KristofBCoding wants to merge 2 commits intohukkin:masterfrom
KristofBCoding:fix/mdformat-tox-compatibility
Open

Fix: mdformat mkdocs compatibility#14
KristofBCoding wants to merge 2 commits intohukkin:masterfrom
KristofBCoding:fix/mdformat-tox-compatibility

Conversation

@KristofBCoding
Copy link
Copy Markdown
Contributor

@KristofBCoding KristofBCoding commented Mar 13, 2025

See #12

Not entirely happy with what i had to do to determine the enabled parser extensions.

@KristofBCoding KristofBCoding changed the title Fix/mdformat tox compatibility Fix: mdformat tox compatibility Mar 13, 2025
@KristofBCoding KristofBCoding marked this pull request as draft March 13, 2025 19:51
This is problemetic when other plugins change how markdown is supposed to look, e.g. mdformat-mkdocs using 4 spaces for indentation.
@KristofBCoding KristofBCoding force-pushed the fix/mdformat-tox-compatibility branch from ec7224c to 27d07b1 Compare March 17, 2025 00:49
@KristofBCoding KristofBCoding changed the title Fix: mdformat tox compatibility Fix: mdformat mkdocs compatibility Mar 17, 2025
@KristofBCoding KristofBCoding marked this pull request as ready for review March 17, 2025 01:03
toc += f"{indentation}- [{heading.text}]({uri})\n"

return toc
# Unlike code-formatters, parser_extensions are stored as a list without
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@KristofBCoding
Copy link
Copy Markdown
Contributor Author

@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.

@LordMailman
Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants