Open hukkin opened 3 years ago
@ichard26 sorry for a horribly long post, but in a nutshell, I propose that for colon-fence
support we simply create mdformat-colon-fence
plugin (or similar name), and for MyST+colon_fence
support one would need to
pip install mdformat-myst mdformat-colon-fence
I don't have the need or motivation to create that plugin right now myself, but will help and support you or anyone else willing to do so. Here's a plugin template to get started btw.
Sounds good, I'll look into it, totally new to this but it looks fun too!
Some implementation pointers:
The colon fence extension for the Markdown parser lies in mdit_py_plugins
PyPI package.
To enable that in the mdformat plugin one needs to do
from markdown_it import MarkdownIt
from mdit_py_plugins.colon_fence import colon_fence_plugin
def update_mdit(mdit: MarkdownIt) -> None:
mdit.use(colon_fence_plugin)
Then what is needed is the renderer function for "colon_fence"
syntax. Probably should run the (already existing) renderer function of "fence"
syntax, and use a regex or something to replace the leading and trailing `
characters with :
chars.
yep for https://github.com/executablebooks/rst-to-myst/pull/18, will need colon_fence, deflist, and substitution (all from mdit_py_plugins)
Soooooo, I totally forgot about this since psf/black ended up not using colon_fence, but I am still willing to implement colon_fence
, although if you want it in a quick timeframe, don't count on me 😅
do you want to transfer this repo to executablebooks @hukkin
Makes sense to me. Transferred!
EDIT: Seems I lost admin rights in the process. @chrisjsewell would you be able to fix that?
yep you should have maintenance rights now 👍
I would really like the ability to turn on/off MyST syntax, so I can easily use mdformat-myst
on some libraries. Primarily, the colon fence feature is of interest to me. I know in #9 there is the idea of adding a --myst-extensions
CLI argument, and I quite like that option, but I'm not sure what is needed to finish this and then start work on adding similar functionality for colon fences.
I just want to open the discussion back up and offer my help. What is the current block to progressing this forward?
Thanks for your work, mdformat
is a great tool!
The current state is that mdformat-myst only supports syntax that is enabled by default in myst-parser. User @ichard26 has voiced the need for optional syntax support (colon fence in particular). The purpose of this issue is to plan how support for optional syntax should be implemented.
I like that there is way to enable default syntax only so we shouldn't simply add optional syntax support the same way we do for non-optionals, as that would prevent installing "myst core" only. So that leaves us with a few options:
mdformat-myst-extensions
(or similar name) plugin that depends onmdformat-myst
but adds optionals on top.mdformat-myst-core
and move this plugin in its current state there. Then make this plugin require it and add optional syntax support.mdformat-colon-fence
,mdformat-amsmath
etc.I think my favorite at least currently is option number 4, having the following strong points:
mdformat-myst
simple and stabletables
syntax is in its own plugin that can be collaboratively enabled bymdformat-gfm
ormdformat-myst
(whichever happens to run first)colon-fence