-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
How to preprocess markdown? #85
Comments
You can walk the returned AST until you find the |
thx does the library support <audio ... and <video markdown tags? |
No problem! And unfortunately not; there’s no syntax in CommonMark for those tags, nor any extension implemented. |
If I want to extend it for myself, something like this:
|
@GildedHonour my downstream branch does something like that, commandeering the image syntax like https://gist.github.com/brson/b180839aa4a236bc78e7b86eca3f7877 I'm not saying this is the cleanest way to do it, but it's what we do - note that when we're in our custom mode, indicated by the 'rtjson' flag - we use a totally new AST node, NodeMeda, to indicate it's special. Elsewhere we have further validation that the text of that node is 'video', 'image', 'gif', etc. - Depending on your needs you might check for those 'keywords' right there to make the decision to use the custom node. From there you just have to edit html.rs, which should be pretty obvious since it's a small repetitive file. Hope that helps. |
@brson Thanks. But I can't understand how that can be useful for my case because that's quite a small part of code. Can you share more? Also, there's "}" missing in the very end, or somewhere else. |
@GildedHonour sorry for the lack of detail. I meant to give a hint of a reasonable place to reinterpret the link syntax. The rest I'd expect to fall out of that via compiler errors. In Another way to do it is to have an AST post-processing pass that walks the AST and looks for |
@brson yes, I can. That's why I asked for more code. |
I'll close this issue out now; thanks @brson for dropping in with pointers from your own work! |
Say, I have a tag audio, video, image or whatever and I want to dynamically adjust it's "source" before rendering it on an html page. Does comrak provide an api for an element to do so?
The text was updated successfully, but these errors were encountered: