@@ -22,31 +22,36 @@ local function generateCustomCSS()
22
22
for type , callout in pairs (customCallouts ) do
23
23
if callout .color then
24
24
local color = pandoc .utils .stringify (callout .color )
25
+ local convertedColor = colorToRgba (color , 1 )
25
26
26
27
-- Base color
27
- css = css .. string.format (" div.callout-style-default.callout-%s {\n " , type )
28
+ css = css .. string.format (" div.callout-%s.callout {\n " , type )
28
29
css = css .. string.format (" border-left-color: %s;\n " , color )
29
30
css = css .. " }\n "
30
31
31
32
-- Header background
32
- css = css .. string.format (" div.callout.callout-style-default.callout-%s > .callout-header {\n " , type )
33
+ css = css .. string.format (" div.callout-%s .callout-style-default > .callout-header {\n " , type )
33
34
css = css .. string.format (" background-color: %s;\n " , colorToRgba (color , 0.13 ))
34
35
css = css .. " }\n "
36
+
37
+ -- Collapse Icon
38
+ css = css .. string.format (" div.callout-%s .callout-toggle::before {" , type )
39
+ css = css .. " background-image: url('data:image/svg+xml,<svg xmlns=\" http://www.w3.org/2000/svg\" width=\" 16\" height=\" 16\" fill=\" rgb(33, 37, 41)\" class=\" bi bi-chevron-down\" viewBox=\" 0 0 16 16\" ><path fill-rule=\" evenodd\" d=\" M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z\" /></svg>');"
40
+ css = css .. " }\n "
35
41
36
-
42
+ -- Icon Styling
43
+ css = css .. string.format (" div.callout-%s.callout-style-default .callout-icon::before, div.callout-%s.callout-titled .callout-icon::before {\n " , type , type )
44
+
37
45
-- Setup the custom icon if it is a symbol
38
46
if callout .icon_symbol then
39
- css = css .. string.format (" div.callout.callout-style-default.callout-%s .callout-icon::before {\n " , type )
40
47
css = css .. string.format (" content: '%s';\n " , pandoc .utils .stringify (callout .icon_symbol ))
41
- css = css .. " font-size: 1rem;\n "
42
48
css = css .. " background-image: none;\n "
43
- css = css .. " }\n "
44
49
else
45
- local escapedColor = color :gsub (" #" , " %%23" )
46
- css = css .. string.format (" div.callout-%s .callout-icon::before {\n " , type )
47
50
css = css .. string.format (" background-image: url('data:image/svg+xml,<svg xmlns=\" http://www.w3.org/2000/svg\" width=\" 16\" height=\" 16\" fill=\" %s\" class=\" bi bi-exclamation-triangle\" viewBox=\" 0 0 16 16\" ><path d=\" M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z\" /></svg>');\n " , escapedColor )
48
- css = css .. " }\n "
49
51
end
52
+
53
+ css = css .. " }\n "
54
+
50
55
end
51
56
end
52
57
return css
0 commit comments