-
DescriptionHi, I'm developing an extension that produces figures from shortcodes that I want to integrate in the document. I can return a I assume the For reference, my shortcode function currently looks like this: function shortcode(args, kwargs, meta)
local output_filepath = "test.png" -- HERE: where to place this file?
pandoc.pipe("some_command_to_generate_a_figure", { "--output", output_filepath }, "")
local caption = ""
return pandoc.Image(caption, output_filepath, nil, nil)
end I've read about HTML dependencies, but I'm not sure this is what I'm looking for. What's the best practice when generating an external figure in Quarto? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Why not base64 encode the image? |
Beta Was this translation helpful? Give feedback.
-
I think it is what you're looking for. Dependencies are the mechanisms Quarto uses to let you communicate resources in disk. If you explicitly add one such dependency, then Quarto will ensure the file is copied to |
Beta Was this translation helpful? Give feedback.
Note that there is no "best practices" so you can do whatever you want.
Quarto LUA API provides a base64 function if you go that road.
QUARTO_PROJECT_OUTPUT_DIR
should be available in LUA filters.Alternatively, you could also generate the content in a directory inside the project, Quarto should automatically add it to the resources if it is used.
If not, you can also add it explicitly to project resources.