mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat(admonition): allow full customization
This commit is contained in:
@@ -1,36 +1,33 @@
|
||||
{{- if eq .Type "alert" -}}
|
||||
{{- $typeMap := dict
|
||||
"attention" "warning"
|
||||
"check" "success"
|
||||
"cite" "quote"
|
||||
"done" "success"
|
||||
"error" "danger"
|
||||
"fail" "failure"
|
||||
"faq" "question"
|
||||
"hint" "tip"
|
||||
"help" "question"
|
||||
"missing" "failure"
|
||||
"summary" "abstract"
|
||||
"tldr" "abstract"
|
||||
-}}
|
||||
{{- /* To customize your own admonitions, you can do the following:
|
||||
|
||||
{{- $iconMap := dict
|
||||
"abstract" "file-lines"
|
||||
"bug" "bug"
|
||||
"caution" "fire"
|
||||
"danger" "fire"
|
||||
"example" "list-ol"
|
||||
"failure" "xmark"
|
||||
"important" "star"
|
||||
"info" "circle-info"
|
||||
"note" "circle-info"
|
||||
"success" "check"
|
||||
"todo" "list-check"
|
||||
"tip" "lightbulb"
|
||||
"question" "circle-question"
|
||||
"quote" "quote-left"
|
||||
"warning" "triangle-exclamation"
|
||||
-}}
|
||||
1. Change colors
|
||||
|
||||
Define your colors in `assets/css/custom.css` using the variables from:
|
||||
https://github.com/nunocoracao/blowfish/blob/main/assets/css/components/admonition.css
|
||||
|
||||
Example:
|
||||
```
|
||||
:root {
|
||||
--adm-note-bg: red;
|
||||
}
|
||||
html.dark {
|
||||
--adm-note-bg: green;
|
||||
}
|
||||
```
|
||||
|
||||
This will update the background color for light and dark mode.
|
||||
|
||||
2. Change icons and type settings
|
||||
|
||||
You can override the default type and icon mappings by creating your own
|
||||
`impls/hooks/admonition-maps.html` in your `layouts` folder.
|
||||
This allows you to assign different icons or styles for each admonition type.
|
||||
*/ -}}
|
||||
|
||||
{{- if eq .Type "alert" -}}
|
||||
{{- $maps := partialCached "impls/hooks/admonition-maps.html" . -}}
|
||||
{{- $typeMap := $maps.typeMap -}}
|
||||
{{- $iconMap := $maps.iconMap -}}
|
||||
|
||||
{{- $rawType := .AlertType | lower -}}
|
||||
{{- $normalizedType := index $typeMap $rawType | default $rawType -}}
|
||||
|
||||
34
layouts/partials/impls/hooks/admonition-maps.html
Normal file
34
layouts/partials/impls/hooks/admonition-maps.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- /* Override this file in your site to customize admonition type aliases and icon mappings */ -}}
|
||||
{{- return dict
|
||||
"typeMap" (dict
|
||||
"attention" "warning"
|
||||
"check" "success"
|
||||
"cite" "quote"
|
||||
"done" "success"
|
||||
"error" "danger"
|
||||
"fail" "failure"
|
||||
"faq" "question"
|
||||
"hint" "tip"
|
||||
"help" "question"
|
||||
"missing" "failure"
|
||||
"summary" "abstract"
|
||||
"tldr" "abstract"
|
||||
)
|
||||
"iconMap" (dict
|
||||
"abstract" "file-lines"
|
||||
"bug" "bug"
|
||||
"caution" "fire"
|
||||
"danger" "fire"
|
||||
"example" "list-ol"
|
||||
"failure" "xmark"
|
||||
"important" "star"
|
||||
"info" "circle-info"
|
||||
"note" "circle-info"
|
||||
"success" "check"
|
||||
"todo" "list-check"
|
||||
"tip" "lightbulb"
|
||||
"question" "circle-question"
|
||||
"quote" "quote-left"
|
||||
"warning" "triangle-exclamation"
|
||||
)
|
||||
-}}
|
||||
Reference in New Issue
Block a user