-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Labels
enhancementNew feature or requestNew feature or requestpluginA plugin should be created or updatedA plugin should be created or updated
Description
Describe the problem/need and solution
Problem
Right now, mdformat
breaks indentation for admonitions. Below is a repeatable example based on the first snippet from the admonition documentation
~/Developer > pipx install mdformat-gfm --include-deps
installed package mdformat-gfm 0.3.5, installed using Python 3.10.2
These apps are now globally available
- markdown-it
- mdformat
done! ✨ 🌟 ✨
~/Developer > pbpaste > ad_test.md
~/Developer > bat ad_test.md
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: ad_test.md
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ !!! type "optional explicit title within double quotes"
2 │ Any number of other indented markdown elements.
3 │
4 │ This is the second paragraph.
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
~/Developer > mdformat ad_test.md
~/Developer > bat ad_test.md
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: ad_test.md
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ !!! type "optional explicit title within double quotes"
2 │ Any number of other indented markdown elements.
3 │
4 │ ```
5 │ This is the second paragraph.
6 │ ```
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Solution
admonitions are not part of the CommonMark specification and would be best handled by a plugin (i.e. mdformat-admonition
)
I would be happy to try writing one, but I wanted to open an issue first so that I'm not duplicating effort. I saw that there was at least one other issue with admonition problems, but there didn't seem to be any updates since: #53 (#53 (comment))
- I naively think the plugin shouldn't be too difficult to implement
- I found the plugin template: https://github.com/executablebooks/mdformat-plugin
- and the mdformat-tables, mdformat-frontmatter, mdformat-footnote, and mdformat source will be useful to reference
- Update: As a reference, here is a plugin that was recently ported with a good implementation
- I found the plugin template: https://github.com/executablebooks/mdformat-plugin
Benefit
Would be nice to have support for admonitions (particular for mkdocs which uses the markdown extension)
Guide for implementation
No response
Tasks and updates
No response
Roald87, brendanator and lyz-code
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpluginA plugin should be created or updatedA plugin should be created or updated