lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
909 stars 73 forks source link

wikilink image cross-references are not implemented #432

Open InnocenseYu opened 2 months ago

InnocenseYu commented 2 months ago

Currently pandoc can be implemented ![[image.ext|image_caption]] syntax according to https://github.com/jgm/pandoc/issues/8853#issuecomment-1698419064

according to the current pandoc-crossref image syntax, hopefully can be like this: ![[image.ext|image_caption]]{#fig:label width=50%}

lierdakil commented 2 months ago

Wikilink images are not treated as figures and don't have attributes, AFAICT. Ostensibly, I could try to hack around this, but I'd rather not tbf. Perhaps you want to open an issue upstream.

FeralFlora commented 1 month ago

Wikilink images are not treated as figures and don't have attributes, AFAICT. Ostensibly, I could try to hack around this, but I'd rather not tbf. Perhaps you want to open an issue upstream.

I made an issue on the Pandoc repo a while ago about supporting link attributes on wikilinks, but it is currently closed as "out of scope" because the wikilink + link attribute syntax combo is not natively supported anywhere at the moment:

We could support it. But the point of the wikilinks extension was to allow interoperability with specific platforms that support this syntax, and they don't support the use of image attributes with it... - jgm

Feel free to add your thoughts on the issue: https://github.com/jgm/pandoc/issues/9048

lierdakil commented 1 month ago

I mean, if upstream says it's out of scope, I can't really argue with that :shrug: The only argument I have is it would be convenient for some users, but you could've made the same exact argument, too.

So... I dunno. The minimal support can be hacked together with a lua filter. But it'll be limited wrt the attributes it can admit -- at least unless someone's willing to do the legwork of making a proper attribute parser in lua, which is not exactly fun.

Doing this upstream will be a bit easier. But upstream is a bit conservative about introducing new syntax, which isn't a bad thing in itself.