lierdakil / pandoc-crossref

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

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

Open mcaruel opened 1 year ago

mcaruel commented 1 year ago

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 ?

lierdakil commented 1 year ago

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

mcaruel commented 1 year ago

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 ?

lierdakil commented 1 year ago

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.

mcaruel commented 1 year ago

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 commented 9 months ago

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 ?

okanakov commented 7 months ago

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

lierdakil commented 6 months ago

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?