New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pluggable Extensions? #615
Comments
There are no current plans to have pluggable extensions. It's a little tricky to do because CommonMark really doesn't have a clean grammar, but that's not to say it's impossible. If you want to see this feature, the best thing to do is review extension mechanisms in other Markdown libraries (I haven't really done this) and bring a proposal. |
@raphlinus have you looked into this since the issue was made? I'd like to implement my own markdown dialect, and this would be nice. I think the main issue is going to be the static-ness of Rust. It's probably best to implement extensions as a third party library that's loaded in, but Rust doesn't have a stable ABI. It might be best to have a mechanism that seamlessly handles this so one can write their extensions dynamically? I think you can do it if you don't mind a nasty C intermediary. It's also worth concerning over versioning; being pre-1.0, the extension API can change in breaking ways. So some versioning would be needed. |
I think the way to go nowadays is WebAssembly, but the main concern I see is the API for extensions and how integrating them in a seamless manner. Probably the parsing code should be converted into a ruleset with priorities, but it is not clear if this is possible without losing too much performance. What do you think, @raphlinus? Anyway, this is not a priority in the project and contributions are welcome but efforts will be focused in other more urgent issues and features requests like the 0.10 release and math support. |
this would be very valuable for me too: I already extended this crate without forking it, but it's quite hacky: And indeed, the difficulty seems to keep a good performance while adding arbitrary syntax As a first partial solution, the library could support parsing rules for what would be otherwise parsed as text, meaning it can not break the existing parser, just extend it. |
I'd just be happy to have a way to hook something in before the smart punctuation and strikethrough extensions interpret the text so I can implement Compose key-style shortcodes like |
Is there any plans in future to have pluggable extensions (perhaps there is already and I missed it)?
I wish to have more complex tables, eg:
Or taking example from mdbook I was writing this is the current markdown:
Using this grid syntax it would be:
The text was updated successfully, but these errors were encountered: