lierdakil / pandoc-crossref

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

Can I pretend an image is a table? #336

Open jankap opened 2 years ago

jankap commented 2 years ago

Following situation: I have a rather complex table, rendered as SVG. Can it be added via ![my caption](result-table.svg){#tbl:resultTable} to have a caption on top of the figure and reference it via @tbl:resultTable?

Currently, the reference is rendered as ¿tbl:resultTable?. Is that supposed? :)

Thanks a lot for this great extension!

lierdakil commented 2 years ago

Eh... the stable version of pandoc-crossref is somewhat restrictive about what it will accept as a table. That is, quite literally, a table, which an image technically isn't. The primary reason it works this way is for the sake of more seamless compatibility with LaTeX, but as you can see, this approach has its limitations. This restriction is lifted in the alpha https://github.com/lierdakil/pandoc-crossref/pull/174, at the cost of nerfing LaTeX interoperability into non-existence, but it's pretty rough around the edges, there's not much in terms of documentation, and I'm not sure it builds with the latest pandoc release. Furthermore, spare time has been at a bit of a premium for the past few years, so I don't know when/if I'll be able to work on it. Please do open issues though if you try it, and it doesn't quite work as intended.