diff --git a/_extensions/custom-callout/customcallout.lua b/_extensions/custom-callout/customcallout.lua index c832dbb..067b5ec 100644 --- a/_extensions/custom-callout/customcallout.lua +++ b/_extensions/custom-callout/customcallout.lua @@ -22,31 +22,36 @@ local function generateCustomCSS() for type, callout in pairs(customCallouts) do if callout.color then local color = pandoc.utils.stringify(callout.color) + local convertedColor = colorToRgba(color, 1) -- Base color - css = css .. string.format("div.callout-style-default.callout-%s {\n", type) + css = css .. string.format("div.callout-%s.callout {\n", type) css = css .. string.format(" border-left-color: %s;\n", color) css = css .. "}\n" -- Header background - css = css .. string.format("div.callout.callout-style-default.callout-%s > .callout-header {\n", type) + css = css .. string.format("div.callout-%s.callout-style-default > .callout-header {\n", type) css = css .. string.format(" background-color: %s;\n", colorToRgba(color, 0.13)) css = css .. "}\n" + + -- Collapse Icon + css = css .. string.format("div.callout-%s .callout-toggle::before {", type) + css = css .. " background-image: url('data:image/svg+xml,');" + css = css .. "}\n" - + -- Icon Styling + css = css .. string.format("div.callout-%s.callout-style-default .callout-icon::before, div.callout-%s.callout-titled .callout-icon::before {\n", type, type) + -- Setup the custom icon if it is a symbol if callout.icon_symbol then - css = css .. string.format("div.callout.callout-style-default.callout-%s .callout-icon::before {\n", type) css = css .. string.format(" content: '%s';\n", pandoc.utils.stringify(callout.icon_symbol)) - css = css .. " font-size: 1rem;\n" css = css .. " background-image: none;\n" - css = css .. "}\n" else - local escapedColor = color:gsub("#", "%%23") - css = css .. string.format("div.callout-%s .callout-icon::before {\n", type) css = css .. string.format(" background-image: url('data:image/svg+xml,');\n", escapedColor) - css = css .. "}\n" end + + css = css .. "}\n" + end end return css