diff --git a/README.md b/README.md index ea28b2d..b9dc605 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ This theme is based on Hugo theme [hugo-paper](https://github.com/nanxiaobei/hug - Social icons - Taxonomies support - Table of Content +- Admonition shortcode - SEO Friendly - Comments using [Giscus](https://giscus.app/) - Mathematical notations using [KaTeX](https://katex.org/) diff --git a/content/markdown-syntax.md b/content/markdown-syntax.md index d7fdce3..10e8d82 100644 --- a/content/markdown-syntax.md +++ b/content/markdown-syntax.md @@ -146,3 +146,10 @@ John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good! {% end %} + +## Admonition + +{% admonition(type="tip", title="Tip") %} + +This is a tip. +{% end %} diff --git a/static/icons/abstract.svg b/static/icons/abstract.svg new file mode 100644 index 0000000..3f99d72 --- /dev/null +++ b/static/icons/abstract.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/bug.svg b/static/icons/bug.svg new file mode 100644 index 0000000..26b46fe --- /dev/null +++ b/static/icons/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/danger.svg b/static/icons/danger.svg new file mode 100644 index 0000000..a66018a --- /dev/null +++ b/static/icons/danger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/example.svg b/static/icons/example.svg new file mode 100644 index 0000000..5dee615 --- /dev/null +++ b/static/icons/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/failure.svg b/static/icons/failure.svg new file mode 100644 index 0000000..59e0d29 --- /dev/null +++ b/static/icons/failure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/info.svg b/static/icons/info.svg new file mode 100644 index 0000000..652acbe --- /dev/null +++ b/static/icons/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/note.svg b/static/icons/note.svg new file mode 100644 index 0000000..664f2cf --- /dev/null +++ b/static/icons/note.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/question.svg b/static/icons/question.svg new file mode 100644 index 0000000..dadbbd2 --- /dev/null +++ b/static/icons/question.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/quote.svg b/static/icons/quote.svg new file mode 100644 index 0000000..5d1ee18 --- /dev/null +++ b/static/icons/quote.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/success.svg b/static/icons/success.svg new file mode 100644 index 0000000..9ba4259 --- /dev/null +++ b/static/icons/success.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/tip.svg b/static/icons/tip.svg new file mode 100644 index 0000000..d9a1cc8 --- /dev/null +++ b/static/icons/tip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/warning.svg b/static/icons/warning.svg new file mode 100644 index 0000000..0a695fd --- /dev/null +++ b/static/icons/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/main.css b/static/main.css index 3b24ba8..6ef6870 100644 --- a/static/main.css +++ b/static/main.css @@ -1133,6 +1133,10 @@ body { z-index: 50; } +.m-1 { + margin: 0.25rem; +} + .\!my-0 { margin-top: 0px !important; margin-bottom: 0px !important; @@ -1168,6 +1172,11 @@ body { margin-bottom: 1rem; } +.mx-2 { + margin-left: 0.5rem; + margin-right: 0.5rem; +} + .mb-1 { margin-bottom: 0.25rem; } @@ -1260,6 +1269,14 @@ body { height: 100%; } +.h-10 { + height: 2.5rem; +} + +.h-4 { + height: 1rem; +} + .min-h-\[18rem\] { min-height: 18rem; } @@ -1292,6 +1309,14 @@ body { width: 100%; } +.w-10 { + width: 2.5rem; +} + +.w-4 { + width: 1rem; +} + .max-w-3xl { max-width: 48rem; } @@ -1384,6 +1409,10 @@ body { border-radius: 0.5rem; } +.rounded-md { + border-radius: 0.375rem; +} + .rounded-l-md { border-top-left-radius: 0.375rem; border-bottom-left-radius: 0.375rem; @@ -1394,14 +1423,42 @@ body { border-bottom-right-radius: 0.375rem; } +.rounded-l-lg { + border-top-left-radius: 0.5rem; + border-bottom-left-radius: 0.5rem; +} + +.rounded-r-lg { + border-top-right-radius: 0.5rem; + border-bottom-right-radius: 0.5rem; +} + +.rounded-t-lg { + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; +} + .border-\[0\.5px\] { border-width: 0.5px; } +.border-l-4 { + border-left-width: 4px; +} + .border-black\/10 { border-color: rgb(0 0 0 / 0.1); } +.border-l-\[\#651fff\] { + --tw-border-opacity: 1; + border-left-color: rgb(101 31 255 / var(--tw-border-opacity)); +} + +.border-l-\[var\(--admonition-border\)\] { + border-left-color: var(--admonition-border); +} + .\!bg-black\/5 { background-color: rgb(0 0 0 / 0.05) !important; } @@ -1428,6 +1485,14 @@ body { background-color: rgb(255 255 255 / 0.8); } +.bg-\[var\(--admonition-bg\)\] { + background-color: var(--admonition-bg); +} + +.bg-\[var\(--admonition-color\)\] { + background-color: var(--admonition-color); +} + .p-2 { padding: 0.5rem; } @@ -1444,6 +1509,10 @@ body { padding: 1.5rem; } +.p-1 { + padding: 0.25rem; +} + .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; @@ -1706,6 +1775,14 @@ article { background: var(--url) center center/cover no-repeat; } +.\[background\:var\(--url\)\] { + background: var(--url); +} + +.\[background\:var\(--url\)_center_center_no-repeat\] { + background: var(--url) center center no-repeat; +} + :is(.dark .dark\:prose-invert) { --tw-prose-body: var(--tw-prose-invert-body); --tw-prose-headings: var(--tw-prose-invert-headings); diff --git a/templates/shortcodes/admonition.html b/templates/shortcodes/admonition.html new file mode 100644 index 0000000..bffcae6 --- /dev/null +++ b/templates/shortcodes/admonition.html @@ -0,0 +1,29 @@ +{% if type == "note" %} {% set admonition_bg = "rgba(68, 138, 255, 0.1)" %} +{% elif type == "abstract" %} {% set admonition_bg = "rgba(0, 176, 255, 0.1)" %} +{% elif type == "info" %} {% set admonition_bg = "rgba(83, 211, 230, 0.1)" %} +{% elif type == "tip" %} {% set admonition_bg = "rgba(0, 191, 165, 0.1)" %} +{% elif type == "success" %} {% set admonition_bg = "rgba(0, 200, 83, 0.1)" %} +{% elif type == "question" %} {% set admonition_bg = "rgba(100, 221, 23, 0.1)" %} +{% elif type == "warning" %} {% set admonition_bg = "rgba(255, 145, 0, 0.1)" %} +{% elif type == "failure" %} {% set admonition_bg = "rgba(255, 82, 82, 0.1)" %} +{% elif type == "danger" %} {% set admonition_bg = "rgba(68, 138, 255, 0.1)" %} +{% elif type == "bug" %} {% set admonition_bg = "rgba(255, 23, 68, 0.1)" %} +{% elif type == "example" %} {% set admonition_bg = "rgba(101, 31, 255, 0.1)" %} +{% elif type == "quote" %} {% set admonition_bg = "rgba(159, 159, 159, 0.1)" %} +{% endif %} + +