markdown-it-rust / markdown-it

markdown-it js library rewritten in rust
Other
79 stars 9 forks source link

Callbacks for external link references #8

Closed mitsuhiko closed 1 year ago

mitsuhiko commented 1 year ago

It is possible to support callback for external link references in the future, please tell us whether that’s useful for you.

It is indeed useful for me.

Here is my motivation: I'm evaluating this library for a tool I have that currently uses pulldown-cmark. I'm using [foo] to refer to other documents but without foo being registered as a reference, the link does not resolve. Since pre-filling the reference map with all other documents is expensive I rather not do that.

Now there is an alternative for me which is to just register another inline rule that matches [foo] and have that take advantage of the fact that the current text stays unparsed. But I figured before I do that, I ask if it wouldn't be better to add such a callback.

rlidwka commented 1 year ago

I'm adding it in https://github.com/rlidwka/markdown-it.rs/pull/17, now reference handling should be fully customizable

rlidwka commented 1 year ago

published as 0.5.0, closing as resolved