Skip to content

Commit

Permalink
Add typst support (quarto-ext#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Jan 28, 2024
1 parent d334eba commit d33823d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions _extensions/fontawesome/fontawesome.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ local function ensureHtmlDeps()
})
end

local function ensure_typst_font_awesome()
if included_font_awesome then
return
end
included_font_awesome = true
quarto.doc.include_text("in-header", "#import \"@preview/fontawesome:0.1.0\": *")
end

local function isEmpty(s)
return s == nil or s == ''
end
Expand Down Expand Up @@ -77,6 +85,13 @@ return {
else
return pandoc.RawInline('tex', "{\\" .. size .. "\\faIcon{" .. icon .. "}}")
end
elseif quarto.doc.is_format("typst") then
ensure_typst_font_awesome()
if isEmpty(isValidSize(size)) then
return pandoc.RawInline('typst', "#fa-icon(\"" .. icon .. "\")")
else
return pandoc.RawInline('typst', "#fa-icon(\"" .. icon .. "\", size: ", size, ")")
end
else
return pandoc.Null()
end
Expand Down

0 comments on commit d33823d

Please sign in to comment.