aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/templates/assets/stylesheets/main/extensions/markdown
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-10-07 06:48:07 +0800
committer简律纯 <i@jyunko.cn>2023-10-07 06:48:07 +0800
commit991fd7a6d67ee017c57beaaa21fc31c4bee7944d (patch)
treee895202203fcaa50b0052f60ef6fc7d6d2928cf9 /src/templates/assets/stylesheets/main/extensions/markdown
parentd62900046bb6f754a8e6e7e670a66a90134055d9 (diff)
downloadinfini-991fd7a6d67ee017c57beaaa21fc31c4bee7944d.tar.gz
infini-991fd7a6d67ee017c57beaaa21fc31c4bee7944d.zip
feat(version): versions
Diffstat (limited to 'src/templates/assets/stylesheets/main/extensions/markdown')
-rw-r--r--src/templates/assets/stylesheets/main/extensions/markdown/_admonition.scss195
-rw-r--r--src/templates/assets/stylesheets/main/extensions/markdown/_footnotes.scss146
-rw-r--r--src/templates/assets/stylesheets/main/extensions/markdown/_toc.scss92
3 files changed, 433 insertions, 0 deletions
diff --git a/src/templates/assets/stylesheets/main/extensions/markdown/_admonition.scss b/src/templates/assets/stylesheets/main/extensions/markdown/_admonition.scss
new file mode 100644
index 00000000..bf517989
--- /dev/null
+++ b/src/templates/assets/stylesheets/main/extensions/markdown/_admonition.scss
@@ -0,0 +1,195 @@
+////
+/// Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a
+/// copy of this software and associated documentation files (the "Software"),
+/// to deal in the Software without restriction, including without limitation
+/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/// and/or sell copies of the Software, and to permit persons to whom the
+/// Software is furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/// DEALINGS
+////
+
+@use "sass:color";
+@use "sass:list";
+
+// ----------------------------------------------------------------------------
+// Variables
+// ----------------------------------------------------------------------------
+
+/// Admonition flavours
+$admonitions: (
+ "note": pencil-circle $clr-blue-a200,
+ "abstract": clipboard-text $clr-light-blue-a400,
+ "info": information $clr-cyan-a700,
+ "tip": fire $clr-teal-a700,
+ "success": check $clr-green-a700,
+ "question": help-circle $clr-light-green-a700,
+ "warning": alert $clr-orange-a400,
+ "failure": close $clr-red-a200,
+ "danger": lightning-bolt-circle $clr-red-a400,
+ "bug": shield-bug $clr-pink-a400,
+ "example": test-tube $clr-deep-purple-a200,
+ "quote": format-quote-close $clr-grey
+) !default;
+
+// ----------------------------------------------------------------------------
+// Rules: layout
+// ----------------------------------------------------------------------------
+
+// Admonition variables
+:root {
+ @each $name, $props in $admonitions {
+ --md-admonition-icon--#{$name}:
+ svg-load("material/#{list.nth($props, 1)}.svg");
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+// Scoped in typesetted content to match specificity of regular content
+.md-typeset {
+
+ // Admonition - note that all styles also apply to details tags, which are
+ // rendered as collapsible admonitions with summary elements as titles.
+ .admonition {
+ display: flow-root;
+ padding: 0 px2rem(12px);
+ margin: px2em(20px, 12.8px) 0;
+ font-size: px2rem(12.8px);
+ color: var(--md-admonition-fg-color);
+ background-color: var(--md-admonition-bg-color);
+ border: px2rem(1.5px) solid $clr-blue-a200;
+ border-radius: px2rem(4px);
+ box-shadow: var(--md-shadow-z1);
+ transition: box-shadow 125ms;
+ page-break-inside: avoid;
+
+ // [print]: Omit shadow as it may lead to rendering errors
+ @media print {
+ box-shadow: none;
+ }
+
+ // Admonition on focus
+ &:focus-within {
+ box-shadow: 0 0 0 px2rem(4px) color.adjust($clr-blue-a200, $alpha: -0.9);
+ }
+
+ // Hack: Chrome exhibits a weird issue where it will set nested elements to
+ // content-box. Doesn't happen in other browsers, so looks like a bug.
+ > * {
+ box-sizing: border-box;
+ }
+
+ // Adjust vertical spacing for nested admonitions
+ .admonition {
+ margin-top: 1em;
+ margin-bottom: 1em;
+ }
+
+ // Adjust spacing for contained table wrappers
+ .md-typeset__scrollwrap {
+ margin: 1em px2rem(-12px);
+ }
+
+ // Adjust spacing for contained tables
+ .md-typeset__table {
+ padding: 0 px2rem(12px);
+ }
+
+ // Adjust spacing for single-child tabbed block container
+ > .tabbed-set:only-child {
+ margin-top: 0;
+ }
+
+ // Adjust spacing on last child
+ html & > :last-child {
+ margin-bottom: px2rem(12px);
+ }
+ }
+
+ // Admonition title
+ .admonition-title {
+ position: relative;
+ padding-block: px2rem(8px);
+ padding-inline: px2rem(40px) px2rem(12px);
+ margin-block: 0;
+ margin-inline: px2rem(-12px);
+ font-weight: 700;
+ background-color: color.adjust($clr-blue-a200, $alpha: -0.9);
+ border: none;
+ border-inline-start-width: px2rem(4px);
+ border-start-start-radius: px2rem(2px);
+ border-start-end-radius: px2rem(2px);
+
+ // Adjust spacing for title-only admonitions
+ html &:last-child {
+ margin-bottom: 0;
+ }
+
+ // Admonition icon
+ &::before {
+ position: absolute;
+ top: px2em(10px);
+ width: px2rem(20px);
+ height: px2rem(20px);
+ content: "";
+ background-color: $clr-blue-a200;
+ inset-inline-start: px2rem(12px);
+ mask-image: var(--md-admonition-icon--note);
+ mask-position: center;
+ mask-repeat: no-repeat;
+ mask-size: contain;
+ }
+
+ // Inline code block
+ code {
+ box-shadow: 0 0 0 px2rem(1px) var(--md-default-fg-color--lightest);
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Rules: flavours
+// ----------------------------------------------------------------------------
+
+// Define admonition flavors
+@each $name, $props in $admonitions {
+ $tint: list.nth($props, 2);
+
+ // Admonition flavour
+ .md-typeset .admonition.#{$name} {
+ border-color: $tint;
+
+ // Admonition on focus
+ &:focus-within {
+ box-shadow: 0 0 0 px2rem(4px) color.adjust($tint, $alpha: -0.9);
+ }
+ }
+
+ // Admonition flavour title
+ .md-typeset .#{$name} > .admonition-title {
+ background-color: color.adjust($tint, $alpha: -0.9);
+
+ // Admonition icon
+ &::before {
+ background-color: $tint;
+ mask-image: var(--md-admonition-icon--#{$name});
+ }
+
+ // Details marker
+ &::after {
+ color: $tint;
+ }
+ }
+}
diff --git a/src/templates/assets/stylesheets/main/extensions/markdown/_footnotes.scss b/src/templates/assets/stylesheets/main/extensions/markdown/_footnotes.scss
new file mode 100644
index 00000000..59447d89
--- /dev/null
+++ b/src/templates/assets/stylesheets/main/extensions/markdown/_footnotes.scss
@@ -0,0 +1,146 @@
+////
+/// Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a
+/// copy of this software and associated documentation files (the "Software"),
+/// to deal in the Software without restriction, including without limitation
+/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/// and/or sell copies of the Software, and to permit persons to whom the
+/// Software is furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/// DEALINGS
+////
+
+// ----------------------------------------------------------------------------
+// Rules
+// ----------------------------------------------------------------------------
+
+// Footnotes variables
+:root {
+ --md-footnotes-icon: svg-load("material/keyboard-return.svg");
+}
+
+// ----------------------------------------------------------------------------
+
+// Scoped in typesetted content to match specificity of regular content
+.md-typeset {
+
+ // Footnote container
+ .footnote {
+ font-size: px2rem(12.8px);
+ color: var(--md-default-fg-color--light);
+
+ // Footnote list - omit left indentation
+ > ol {
+ margin-inline-start: 0;
+
+ // Footnote item - footnote items can contain lists, so we need to scope
+ // the spacing adjustments to the top-level footnote item.
+ > li {
+ transition: color 125ms;
+
+ // Darken color on target
+ &:target {
+ color: var(--md-default-fg-color);
+ }
+
+ // Show backreferences on footnote focus without transition
+ &:focus-within .footnote-backref {
+ opacity: 1;
+ transition: none;
+ transform: translateX(0);
+ }
+
+ // Show backreferences on footnote hover/target
+ &:is(:hover, :target) .footnote-backref {
+ opacity: 1;
+ transform: translateX(0);
+ }
+
+ // Adjust spacing on first child
+ > :first-child {
+ margin-top: 0;
+ }
+ }
+ }
+ }
+
+ // Footnote reference
+ .footnote-ref {
+ font-size: px2em(12px, 16px);
+ font-weight: 700;
+
+ // Hack: increase specificity to override default
+ html & {
+ outline-offset: px2rem(2px);
+ }
+ }
+
+ // Show outline for all devices
+ [id^="fnref:"]:target > .footnote-ref {
+ outline: auto;
+ }
+
+ // Footnote backreference
+ .footnote-backref {
+ display: inline-block;
+ // Hack: omit Unicode arrow for replacement with icon
+ font-size: 0;
+ color: var(--md-typeset-a-color);
+ vertical-align: text-bottom;
+ opacity: 0;
+ transition:
+ color 250ms,
+ transform 250ms 250ms,
+ opacity 125ms 250ms;
+ transform: translateX(px2rem(5px));
+
+ // [print]: Show footnote backreferences
+ @media print {
+ color: var(--md-typeset-a-color);
+ opacity: 1;
+ transform: translateX(0);
+ }
+
+ // Adjust for right-to-left languages
+ [dir="rtl"] & {
+ transform: translateX(px2rem(-5px));
+ }
+
+ // Adjust color on hover
+ &:hover {
+ color: var(--md-accent-fg-color);
+ }
+
+ // Footnote backreference icon
+ &::before {
+ display: inline-block;
+ width: px2rem(16px);
+ height: px2rem(16px);
+ content: "";
+ background-color: currentcolor;
+ mask-image: var(--md-footnotes-icon);
+ mask-position: center;
+ mask-repeat: no-repeat;
+ mask-size: contain;
+
+ // Adjust for right-to-left languages
+ [dir="rtl"] & {
+
+ // Flip icon vertically
+ svg {
+ transform: scaleX(-1);
+ }
+ }
+ }
+ }
+}
diff --git a/src/templates/assets/stylesheets/main/extensions/markdown/_toc.scss b/src/templates/assets/stylesheets/main/extensions/markdown/_toc.scss
new file mode 100644
index 00000000..8284a5c0
--- /dev/null
+++ b/src/templates/assets/stylesheets/main/extensions/markdown/_toc.scss
@@ -0,0 +1,92 @@
+////
+/// Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
+///
+/// Permission is hereby granted, free of charge, to any person obtaining a
+/// copy of this software and associated documentation files (the "Software"),
+/// to deal in the Software without restriction, including without limitation
+/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/// and/or sell copies of the Software, and to permit persons to whom the
+/// Software is furnished to do so, subject to the following conditions:
+///
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+///
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/// DEALINGS
+////
+
+// ----------------------------------------------------------------------------
+// Rules
+// ----------------------------------------------------------------------------
+
+// Scoped in typesetted content to match specificity of regular content
+.md-typeset {
+
+ // Headerlink
+ .headerlink {
+ display: inline-block;
+ margin-inline-start: px2rem(10px);
+ color: var(--md-default-fg-color--lighter);
+ opacity: 0;
+ transition:
+ color 250ms,
+ opacity 125ms;
+
+ // [print]: Hide headerlinks
+ @media print {
+ display: none;
+ }
+ }
+
+ // Show headerlinks on parent hover
+ :is(:hover, :target) > .headerlink,
+ .headerlink:focus {
+ opacity: 1;
+ transition:
+ color 250ms,
+ opacity 125ms;
+ }
+
+ // Adjust color on parent target or focus/hover
+ :target > .headerlink,
+ .headerlink:is(:focus, :hover) {
+ color: var(--md-accent-fg-color);
+ }
+
+ // Adjust scroll margin for all elements with `id` attributes
+ :target {
+ --md-scroll-margin: #{px2rem(48px + 24px)};
+ --md-scroll-offset: #{px2rem(0px)};
+ // Scroll margin is finally ready for prime time - before, we used a hack
+ // for anchor correction based on pseudo elements but those times are gone.
+ scroll-margin-top:
+ calc(
+ var(--md-scroll-margin) -
+ var(--md-scroll-offset)
+ );
+
+ // [screen +]: Sticky navigation tabs
+ @include break-from-device(screen) {
+
+ // Adjust scroll margin for sticky navigation tabs
+ .md-header--lifted ~ .md-container & {
+ --md-scroll-margin: #{px2rem(96px + 24px)};
+ }
+ }
+ }
+
+ // Adjust scroll offset for headlines of level 1-3
+ :is(h1, h2, h3):target {
+ --md-scroll-offset: #{px2rem(4px)};
+ }
+
+ // Adjust scroll offset for headlines of level 4
+ h4:target {
+ --md-scroll-offset: #{px2rem(3px)};
+ }
+}