-
DescriptionI’ve written a Lua filter that I would like to be able to use with Pandoc and with Quarto. It works with both but, because the preamble (it’s a filter for latex) is not exactly the same when generating from Pandoc or Quarto, the resulting PDF doesn’t look the same. Is there a way I can detect if my filter is launched with Quarto or with Pandoc, so my filter can adapt accordingly to compensate the difference? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Good question ! One way to do it is that if your filter is ran within Quarto context, the Quarto Lua API will be defined So you could test for Example if quarto and quarto.version then
quarto.log.output("Running in Quarto: " .. tostring(quarto.version))
else
print("Not running in Quarto")
end
return {} |
Beta Was this translation helpful? Give feedback.
-
If there is a proper way to do that, I’m interested but for now I’ll go with: if quarto ~= nil then
print("Quarto")
else
print("Pandoc")
end |
Beta Was this translation helpful? Give feedback.
Good question !
One way to do it is that if your filter is ran within Quarto context, the Quarto Lua API will be defined
https://prerelease.quarto.org/docs/extensions/lua-api.html#quarto-lua-api
So you could test for
quarto
object, orquarto.version
for example. If it exists, then you are in Quarto context.Example