mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
756 stars 138 forks source link

Differentiate between referenced and inline links #129

Closed mondeja closed 3 years ago

mondeja commented 3 years ago
mity commented 3 years ago

Differentiate between referenced and inline links

Can you please elaborate what is it good for or what's your use case?

Introduce label in A span details.

Why to provide the label in a different way than in the case of an inline link?

Introduce is_inline_link in A span details to add the possibility to discover if a link is a collapsed reference link.

If we decide to implement it, it should allow to differentiate all link types: inline link, a full reference link, a collapsed reference link as well as a shortcut reference link.

But IMHO it should rather be provided by the (not-yet-implemented) syntax callback, which should hopefully provide a lot of info about the source Markdown rather than about its meaning. But maybe you can change my mind if you explain your use case.

mondeja commented 3 years ago

If we decide to implement it, it should allow to differentiate all link types: inline link, a full reference link, a collapsed reference link as well as a shortcut reference link.

I agree with any implementation, it's only that inline links and full reference links are the most used, at least as I know.

But IMHO it should rather be provided by the (not-yet-implemented) syntax callback, which should hopefully provide a lot of info about the source Markdown rather than about its meaning.

This implementation sound sufficient for my usage and I can't find a case in which the syntax in the links can refer meaning.

Thanks for your quick response, I'm closing this...