How do I reference svgs as icons (as an HTML dependency) within a Quarto short-code extension? #6326
-
DescriptionI have a folder of SVG icons, and I want to create a Quarto short-code extension in the vein of 'fontawesome' and 'academicons' where I can use them in HTML reports. In both of these extensions, I observe that the icons themselves are available in a .woff or .woff2 extension. I do not have that. Is it still possible to reference the individual SVG icons as an html dependency in the lua code? Perhaps with:
Or is there another, better way to do this? I apologize if this is insufficiently vague. I'm greatly intrigued by the Quarto extension system and think it can be immediately relevant to my work. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
If you're looking at making at making an icon extension, you might find @mcanouil's quarto-iconify extension useful! Iconify collects a whole bunch of other icon sets into one API, so they may already have the icons you're looking for. Otherwise, that extension might be a useful starting off point in building your own 😊 |
Beta Was this translation helpful? Give feedback.
-
Ah, thanks that was indeed one of the examples I studied in detail! But their lone html dependency is a minified js file, not a woff, woff2, or svg. This is the dependency step I am unsure how to navigate with my svgs. |
Beta Was this translation helpful? Give feedback.
To note SVGs are not scripts, see the LUA API documentation regarding adding dependencies (https://quarto.org/docs/extensions/lua-api.html#html-dependencies).
Also, if you intend to use your SVG as font glyphs/icons, you might need to change the format and you need CSS to "call" the glyphs in questions as other icons libraries do.
There are plenty of examples on the Internet.
When wanting to develop an extension targeting a format (HTML, LaTeX), you need to know the rules of that format/language which unfortunately cannot be taught by Quarto.