Closed amine-aboufirass closed 1 year ago
I don't know much about the minted filter; maybe @svenevs as the author of that filter can help?
Sure, I can try :upside_down_face: I've been out of touch with this stuff for years, wrote that filter during jury duty. @amine-aboufirass it would be helpful if you could share with me a quick minimal working example of a document that is using both minted and pandoc-crossref (edit: and how you are building things). I know I was using crossref at the time, vaguely remember filter order being a thing and that crossref always has to be first or something. But I should be able to run the tests this weekend if I can find a bootable linux system that's not my work computer.
Existing tests and were happy: https://github.com/pandoc/lua-filters/actions/runs/4375232713/jobs/7655760573#step:4:52
but maybe we should be adding to the test something that uses crossref? not sure if that's going to be easy
oh sorry read too quick, https://github.com/lierdakil/pandoc-crossref/issues/379 looks like it has enough for me to work with
@svenevs @lierdakil i've been looking at this stuff a bit more closely. Before I elaborate I think it's useful to note that my use case has the following requirements:
This pull request was attempting to address the 5th item. However, it turns out pandoc-crossref
also has difficulty with minted.lua
because pandoc-crossref
defines the following in header-includes
:
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
Since minted
already defines a \listoflistings
, LaTeX will crash. One workaround would be to undefine that command after \usepackage{minted}
and before the header-include
, but there's no telling whether that would impact someone trying to actually generate a list of listings.
To be more complete, this pull request would require one of the following items:
pandoc-crossref
in Haskellheader-includes
necessary for minted.lua
to work properly if references are requiredFor your information, the minted package defines \listoflistings exactly as pandoc-crossref does, so it would be safe to reset it to @.*** after minted has been loaded (it would only prevent users from redefining the “List of listings” string via \listoflistingscaption, but pandoc-crossref provides the lolTitle metadata variable for that).
@badumont in that case it might be better to update the README for minted.lua to reflect that. @svenevs any thoughts on that?
minted.lua
unconditionally strips the code block identifier when processing withpandoc-crossref
. This makes the current implementation ofminted.lua
incompatible withpandoc-crossref
. Please see this thread for more details.This change allows documents filtered by
pandoc-crossref
and then byminted.lua
to preserve references. This combines the best of both worlds.I was not able to run the tests to check if this is a breaking change, because of this issue in my WSL install. If someone can show me how to run the tests for
minted.lua
on a Windows machine and there are breaking changes I'd be glad to work through them or add new tests if necessary.@tarleb