pandoc-crossref icon indicating copy to clipboard operation
pandoc-crossref copied to clipboard

I developed a slightly enhanced version of the filter `texref.lua` suggested by @lierdakil above:

Open mcaruel opened this issue 2 years ago • 7 comments

In case you want to use https://quarto.org/ you should remove the comments from the line with the comment -- for quarto. Here we will replace : with - in the reference labels, because quarto uses a slightly different prefix convention for labels than pandoc-crossref (see https://quarto.org/docs/authoring/cross-references.html ).

Originally posted by @asmaier in https://github.com/lierdakil/pandoc-crossref/issues/250#issuecomment-1169233033

Is it possible to change the convention fig: to fig- (same for other type of references too) in pandoc-crossref so that I can render a .md file using my standard Pandora AND using Quarto ?

mcaruel avatar Jul 24 '22 20:07 mcaruel

No, prefixes are hard-coded, at least in the mainline version.

lierdakil avatar Aug 01 '22 09:08 lierdakil

No, prefixes are hard-coded, at least in the mainline version.

Sorry @lierdakil , I don't understand your reply. Do you mean that the syntax doesn't matter for the Labels ? If this is the case, which is good, then the fact that the fig: links are not working in Quarto is due to Quarto and not to Pandoc. Am I correct ?

mcaruel avatar Aug 18 '22 07:08 mcaruel

Uh. Looking back at it, I guess I misunderstood the question?

So the prefixes are hard-coded, : included, so there's no way to change those client-side. Changing this convention pandoc-crossef side at this point would break compatibility in a big way, besides - is kind of ambiguous.

Arguably I could cook something up hidden behind a flag, but this seems like a very niche use case, so I'm not sure if I can justify the effort. Feel free to argue otherwise.

lierdakil avatar Sep 17 '22 09:09 lierdakil

You understood correctly. I would be very nice to be able to define the prefixes in a yaml configuration file but I totally understand that this may not be the priority. The fact that there is no global convention throughout the markdown galaxy can be a bit annoying but I guess we all have to leave with that. The problem is when you want to share your .md document with somebody else who does not have the same setup. This is one big advantage of working with a mature editing language like TeX: it works equally everywhere. To me Markdown is still behind in terms of "syntax maturity" but it is evolving fast !! Thank you again for your work !

mcaruel avatar Sep 17 '22 12:09 mcaruel

Hi @lierdakil , I would like to know if a pandoc filter could help me on that. I don't know anything about Lua-filter but I guess there could be a filter converting all references from say #fig- to #fig:. Do you think that could be a solution ?

mcaruel avatar Oct 06 '23 07:10 mcaruel

I suggest to modify the lua filter script in order to prevent producing empty lines, see my comment in #250.

okanakov avatar Dec 14 '23 15:12 okanakov

a filter converting all references from say #fig- to #fig:

Do you even need a filter though? I suspect a simple regex substitution could work, something to the tune of s/([#@])(fig|eq|tbl|lst)-/\1\2:/g?

lierdakil avatar Dec 28 '23 21:12 lierdakil