Context
It would be nice if there was an easy way to have a function resolve link references that haven't been registered (similar to pulldown-cmark https://docs.rs/pulldown-cmark/0.13.1/pulldown_cmark/struct.Parser.html#method.new_with_broken_link_callback).
So we can programmatically decide the href of something like this:
I didn't find anything in the documentation describing how to properly do this, and the only work around I found was to copy and paste the link function in rules_inline (
|
def link(state: StateInline, silent: bool) -> bool: |
) and whenever false is returned when
parseReference is true to put some custom logic to try to resolve the reference.
And then register this rule with:
md = markdown_it.MarkdownIt()
def custom_link(state, silent):
....
md.inline.ruler.disable("link")
md.inline.ruler.push("custom_link", custom_link)
It would be very nice if there was some blessed route to be able to do this.
Proposal
No response
Tasks and updates
No response
Context
It would be nice if there was an easy way to have a function resolve link references that haven't been registered (similar to pulldown-cmark https://docs.rs/pulldown-cmark/0.13.1/pulldown_cmark/struct.Parser.html#method.new_with_broken_link_callback).
So we can programmatically decide the href of something like this:
I didn't find anything in the documentation describing how to properly do this, and the only work around I found was to copy and paste the link function in rules_inline (
markdown-it-py/markdown_it/rules_inline/link.py
Line 7 in 8933147
parseReferenceis true to put some custom logic to try to resolve the reference.And then register this rule with:
It would be very nice if there was some blessed route to be able to do this.
Proposal
No response
Tasks and updates
No response