aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-02-06 09:02:48 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2026-02-06 09:02:48 +0100
commit2350395bdc1afe135141bd8a2d08f63ec3c8d4cb (patch)
treebb283c9e6c78b3b84be807cce9820ee998fede5f
parent91083bbb6ecc47e2ece4cec0ddf7cb784a76f405 (diff)
feat(frontend): default color for unknown callout
-rw-r--r--frontend/scss/main.scss6
-rw-r--r--markdown/ast_callout.go8
2 files changed, 11 insertions, 3 deletions
diff --git a/frontend/scss/main.scss b/frontend/scss/main.scss
index ced6763..390112b 100644
--- a/frontend/scss/main.scss
+++ b/frontend/scss/main.scss
@@ -11,6 +11,9 @@
--color-light-rose: hsl(330, 55%, 70%, 0.2); /* link accent hover and highlight */
--color-black: rgba(0, 0, 0, 0.4); /* pre, code */
+ --callout-color-background: hsl(210, 10%, 23%);
+ --callout-color: hsl(210, 14%, 89%);
+
@media (prefers-color-scheme: light) {
--color-dark: #dbf6f6;
--color-light: hsl(202, 25%, 9%);
@@ -18,6 +21,9 @@
--color-rose: #a01a5e; /* link accent */
--color-light-rose: hsla(330, 86%, 67%, 0.2); /* link accent hover and highlight */
--color-black: rgba(0, 0, 0, 0.2); /* pre, code */
+
+ --callout-color-background: hsl(210, 14%, 89%);
+ --callout-color: hsl(210, 10%, 23%);
}
--font-size-tiny: 0.85rem; /* quote, legend, code */
diff --git a/markdown/ast_callout.go b/markdown/ast_callout.go
index 769d714..d538a09 100644
--- a/markdown/ast_callout.go
+++ b/markdown/ast_callout.go
@@ -40,9 +40,11 @@ func (a *astCallout) Eval(opt *Option) (template.HTML, *ParseError) {
}
title := dom.NewLiteralContentElement("h4", titleContent)
- callout := dom.NewContentElement("div", make([]dom.Element, 2))
- callout.Contents[0] = title
- callout.Contents[1] = inner
+ callout := dom.NewContentElement("div", make([]dom.Element, 0))
+ callout.Contents = append(callout.Contents, title)
+ if len(inner.Contents) > 0 {
+ callout.Contents = append(callout.Contents, inner)
+ }
callout.SetAttribute("data-kind", a.kind)
callout.ClassList().Add("callout")
return callout.Render(), nil