Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/docs/extensions/project/_extensions/quarto-ext/fontawesome/fontawesome.lua
3571 views
1
function ensureLatexDeps()
2
quarto.doc.useLatexPackage("fontawesome5")
3
end
4
5
function ensureHtmlDeps()
6
quarto.doc.addHtmlDependency({
7
name = 'fontawesome6',
8
version = '0.1.0',
9
stylesheets = {'assets/css/all.css'}
10
})
11
end
12
13
return {
14
["fa"] = function(args, kwargs)
15
16
local group = "solid"
17
local icon = pandoc.utils.stringify(args[1])
18
if #args > 1 then
19
group = icon
20
icon = pandoc.utils.stringify(args[2])
21
end
22
23
-- detect html (excluding epub which won't handle fa)
24
if quarto.doc.isFormat("html:js") then
25
ensureHtmlDeps()
26
return pandoc.RawInline('html', "<i class=\"fa-" .. group .. " fa-" .. icon .. "\"></i>")
27
-- detect pdf / beamer / latex / etc
28
elseif quarto.doc.isFormat("pdf") then
29
ensureLatexDeps()
30
return pandoc.RawInline('tex', "\\faIcon{" .. icon .. "}")
31
else
32
return {}
33
end
34
35
end
36
}
37