{{ .Title }}
-{{ .Title }}
+{{ .Description | markdownify | safeHTML }}
+ {{ if .Params.toc }} + {{ partial "toc.html" . }} + {{ end }}diff --git a/assets/js/theme.js b/assets/js/theme.js index bdc246d..d17e9c0 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -8,7 +8,7 @@ themeSwitcher.innerHTML = localStorage.theme === LIGHT ? light : dark; themeSwitcher.addEventListener('click', function () { const currentTheme = localStorage.theme, newTheme = currentTheme === LIGHT ? DARK : LIGHT, - { classList } = document.querySelector('html'), + { classList } = document.documentElement, text = newTheme === LIGHT ? light : dark; classList.remove(currentTheme); classList.add(newTheme); diff --git a/assets/sass/atom.scss b/assets/sass/atom.scss new file mode 100644 index 0000000..11d6655 --- /dev/null +++ b/assets/sass/atom.scss @@ -0,0 +1,119 @@ +* { + line-height: 1; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} + +$unit: 0.25rem; +$scales: 0, 1, 2, 3, 4, 5, 6, 7, 8, 1.5; +$screens: ( + sm\:: 640px, +); + +@mixin scale_with_prefix($prefix, $scale) { + $size: $scale * $unit; + .#{$prefix}mt-#{$scale} { + margin-top: $size; + } + .#{$prefix}mb-#{$scale} { + margin-bottom: $size; + } + .#{$prefix}ml-#{$scale} { + margin-left: $size; + } + .#{$prefix}mr-#{$scale} { + margin-right: $size; + } + .#{$prefix}my-#{$scale} { + margin-top: $size; + margin-bottom: $size; + } + .#{$prefix}mx-#{$scale} { + margin-left: $size; + margin-right: $size; + } +} + +@each $scale in $scales { + @include scale_with_prefix("", $scale); + + @each $screen, $size in $screens { + @media (max-width: $size) { + @include scale_with_prefix($screen, $scale); + } + } +} + +@mixin style_with_prefix($prefix) { + .#{$prefix}block { + display: block; + } + .#{$prefix}flex { + display: flex; + } + .#{$prefix}flex-row { + flex-direction: row; + } + .#{$prefix}flex-col { + flex-direction: column; + } + .#{$prefix}flex-col-reverse { + flex-direction: column-reverse; + } + .#{$prefix}justify-between { + justify-content: space-between; + } + .#{$prefix}flex-nowrap { + flex-wrap: nowrap; + } + .#{$prefix}items-center { + align-items: center; + } + .#{$prefix}self-start { + align-self: flex-start; + } + .#{$prefix}hidden { + display: none; + } + .#{$prefix}text-xs { + font-size: .8rem; + } + .#{$prefix}text-sm { + font-size: .9rem; + } + .#{$prefix}text-4xl { + font-size: 2.25rem; + } +} + +@include style_with_prefix(""); +@each $screen, $size in $screens { + @media (max-width: $size) { + @include style_with_prefix($screen); + } +} + +// border width +.bw-0 { + border-width: 0; +} + +// width +.min-w-32 { + min-width: 0.25 * 32rem; +} + +.whitespace-nowrap { + white-space: nowrap; +} + +.overflow-x-auto { + overflow-x: auto; +} + +.overflow-y-hidden { + overflow-y: hidden; +} + +.cursor-pointer { + cursor: pointer; +} diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 5fad051..82a55fd 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -1,5 +1,4 @@ -@import "normalize.scss"; -@import "sketch.scss"; +@import "atom.scss"; @import "markdown.scss"; @import "syntax.scss"; @@ -27,18 +26,15 @@ html.dark { } body { - font-family: Helvetica, sans-serif; + font-family: "Helvetica Neue", Helvetica, sans-serif; max-width: var(--w-mobile); - margin: 50px auto 0; + margin: 3rem auto 0; font-size: 16px; font-weight: 400; color: var(--ft); background-color: var(--bg); transition-property: background-color, border-color, color; transition-duration: 0.5s; - @media (max-width: 640px) { - margin: 1em 2em; - } } h1, @@ -46,19 +42,16 @@ h2, h3, h4, h5 { - font-family: "Noto Serif SC", "Times New Roman", sans-serif; + font-family: "Noto Serif SC", 'Times New Roman', Times, sans-serif; font-weight: 700; - line-height: 1.5; } p { - margin-top: 0; - line-height: 1.5; - text-align: left; + line-height: 1.8; + text-align: justify; } hr { - margin: 30px 0; border-width: 0; border-top: 1px solid var(--bd); } @@ -103,9 +96,23 @@ main { animation: showup 0.7s; } +header nav { + color: var(--tag); +} + +details.toc ul { + list-style-type: none; + padding-inline-start: 1em; + margin: 0; +} + +details.toc ul > li { + margin: 1em 0; +} + ::-webkit-scrollbar { - width: 8px; - height: 8px; + width: 4px; + height: 4px; } ::-webkit-scrollbar-thumb { @@ -119,7 +126,20 @@ main { background-color: rgb(128, 128, 128); } -.nowrap::-webkit-scrollbar { +h1::-webkit-scrollbar, +nav::-webkit-scrollbar { display: none; width: 0; +} + +@keyframes showup { + from { + opacity: 0; + transform: translateY(20px); + } + + to { + opacity: 1; + transform: none; + } } \ No newline at end of file diff --git a/assets/sass/markdown.scss b/assets/sass/markdown.scss index 6fcf843..61aca1b 100644 --- a/assets/sass/markdown.scss +++ b/assets/sass/markdown.scss @@ -1,7 +1,6 @@ .md blockquote { background-color: rgba(148, 148, 149, 0.08) ; - margin: 1.5em 0px; - padding: 1.1em 20px 1px 20px; + padding: 1px 1rem; border-left: 8px solid var(--pm); font-style: italic; } @@ -30,10 +29,6 @@ max-width: 100%; } -.md li { - margin-top: .5em; -} - .md .katex { overflow: auto hidden; } @@ -47,6 +42,23 @@ padding-inline-start: 20px; } +.md li { + margin-bottom: 1rem; +} + +.md ol, +.md ul, +.md img, +.md blockquote, .md .highlight { - margin: 1em 0; -} \ No newline at end of file + margin: .75rem 0; +} + +.md hr { + margin: 1.5rem 0; +} + +.md .footnotes { + white-space: nowrap; + overflow: auto hidden; +} diff --git a/assets/sass/normalize.scss b/assets/sass/normalize.scss deleted file mode 100644 index dc13b8a..0000000 --- a/assets/sass/normalize.scss +++ /dev/null @@ -1,351 +0,0 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ - -/* Document - ========================================================================== */ - -/** - * 1. Correct the line height in all browsers. - * 2. Prevent adjustments of font size after orientation changes in iOS. - */ - -html { - line-height: 1.15; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/* Sections - ========================================================================== */ - -/** - * Remove the margin in all browsers. - */ - -body { - margin: 0; -} - -/** - * Render the `main` element consistently in IE. - */ - -main { - display: block; -} - -/** - * Correct the font size and margin on `h1` elements within `section` and - * `article` contexts in Chrome, Firefox, and Safari. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/* Grouping content - ========================================================================== */ - -/** - * 1. Add the correct box sizing in Firefox. - * 2. Show the overflow in Edge and IE. - */ - -hr { - box-sizing: content-box; /* 1 */ - height: 0; /* 1 */ - overflow: visible; /* 2 */ -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -pre { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Remove the gray background on active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * 1. Remove the bottom border in Chrome 57- - * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. - */ - -abbr[title] { - border-bottom: none; /* 1 */ - text-decoration: underline; /* 2 */ - text-decoration: underline dotted; /* 2 */ -} - -/** - * Add the correct font weight in Chrome, Edge, and Safari. - */ - -b, -strong { - font-weight: bolder; -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -code, -kbd, -samp { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/** - * Add the correct font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` elements from affecting the line height in - * all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove the border on images inside links in IE 10. - */ - -img { - border-style: none; -} - -/* Forms - ========================================================================== */ - -/** - * 1. Change the font styles in all browsers. - * 2. Remove the margin in Firefox and Safari. - */ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ -} - -/** - * Show the overflow in IE. - * 1. Show the overflow in Edge. - */ - -button, -input { - /* 1 */ - overflow: visible; -} - -/** - * Remove the inheritance of text transform in Edge, Firefox, and IE. - * 1. Remove the inheritance of text transform in Firefox. - */ - -button, -select { - /* 1 */ - text-transform: none; -} - -/** - * Correct the inability to style clickable types in iOS and Safari. - */ - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -/** - * Remove the inner border and padding in Firefox. - */ - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** - * Restore the focus styles unset by the previous rule. - */ - -button:-moz-focusring, -[type="button"]:-moz-focusring, -[type="reset"]:-moz-focusring, -[type="submit"]:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** - * Correct the padding in Firefox. - */ - -fieldset { - padding: 0.35em 0.75em 0.625em; -} - -/** - * 1. Correct the text wrapping in Edge and IE. - * 2. Correct the color inheritance from `fieldset` elements in IE. - * 3. Remove the padding so developers are not caught out when they zero out - * `fieldset` elements in all browsers. - */ - -legend { - box-sizing: border-box; /* 1 */ - color: inherit; /* 2 */ - display: table; /* 1 */ - max-width: 100%; /* 1 */ - padding: 0; /* 3 */ - white-space: normal; /* 1 */ -} - -/** - * Add the correct vertical alignment in Chrome, Firefox, and Opera. - */ - -progress { - vertical-align: baseline; -} - -/** - * Remove the default vertical scrollbar in IE 10+. - */ - -textarea { - overflow: auto; -} - -/** - * 1. Add the correct box sizing in IE 10. - * 2. Remove the padding in IE 10. - */ - -[type="checkbox"], -[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Correct the cursor style of increment and decrement buttons in Chrome. - */ - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Correct the odd appearance in Chrome and Safari. - * 2. Correct the outline style in Safari. - */ - -[type="search"] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** - * Remove the inner padding in Chrome and Safari on macOS. - */ - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * 1. Correct the inability to style clickable types in iOS and Safari. - * 2. Change font properties to `inherit` in Safari. - */ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* Interactive - ========================================================================== */ - -/* - * Add the correct display in Edge, IE 10+, and Firefox. - */ - -details { - display: block; -} - -/* - * Add the correct display in all browsers. - */ - -summary { - display: list-item; -} - -/* Misc - ========================================================================== */ - -/** - * Add the correct display in IE 10+. - */ - -template { - display: none; -} - -/** - * Add the correct display in IE 10. - */ - -[hidden] { - display: none; -} diff --git a/assets/sass/sketch.scss b/assets/sass/sketch.scss deleted file mode 100644 index 407d630..0000000 --- a/assets/sass/sketch.scss +++ /dev/null @@ -1,170 +0,0 @@ -.row { - display: flex; - align-items: center; -} - -.col { - display: flex; - flex-direction: column; -} - -.jc-bt { - justify-content: space-between; -} - -.as-s { - align-self: start; -} - -.ai-c { - align-items: center; -} - -.gap-0_5 { - gap: 0.8rem; -} - -.gap-1 { - gap: 1rem; - row-gap: 1rem; -} - -.gap-2 { - gap: 2rem; - row-gap: 2rem; -} - -.gap-3 { - gap: 3rem; - row-gap: 3rem; -} - -.lg-1 { - font-size: 1.2em; -} - -.sm-1 { - font-size: 0.8em; -} - -.mtb-1 { - margin: 1em 0; -} - -.mtb-2 { - margin: 2em 0; -} - -.mb-1 { - margin-bottom: 1em; -} - -.mb-0 { - margin-bottom: 0; -} - -.mt-2 { - margin-top: 2em; -} - -.ml-1 { - margin-left: 1em; -} - -.ml-2 { - margin-left: 2em; -} - -.mx-0_4 { - margin: 0 0.4rem; -} - -.mr-1 { - margin-right: 1rem; -} - -.mr-2 { - margin-right: 2em; -} - -.mw-6 { - min-width: 6em; -} - -.c-tag { - color: var(--tag); -} - -.btn { - cursor: pointer; -} - -.hidden { - display: none; -} - -.tag-pm { - font-size: 0.7em; - font-weight: bold; - line-height: 1; - color: #fff; - background-color: var(--pm); - border-radius: 20px; - padding: 2px 8px; -} - -details.toc ul { - list-style-type: none; - padding-inline-start: 1em; - margin: 0; -} - -details.toc ul > li { - margin: 1em 0; -} - -.nowrap { - white-space: nowrap; - overflow: auto; -} - -@keyframes showup { - from { - opacity: 0; - transform: translateY(20px); - } - - to { - opacity: 1; - transform: none; - } -} - -@media (max-width: 640px) { - .row-mob { - flex-direction: column; - align-items: flex-start; - gap: 0; - row-gap: 0; - } - - .al-c-mob { - align-items: center; - } - - .col-rev-mob { - flex-direction: column-reverse; - } - - .sm-2-mob { - font-size: 0.9em; - } - - .mb-0_5-mob { - margin-bottom: 0.5em; - } - - .mb-1_5-mob { - margin-bottom: 1.5em; - } -} \ No newline at end of file diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e991f75..29f96f5 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -23,7 +23,7 @@ description = "This is Minima, a clean and minimal Hugo theme porting from Minim # iam is the beginning words of your self-introduction. iam = "I am" # The subtitle will be shown after the title of your blog site -# in a format "title - subtitle". +# in a format like "title - subtitle". subtitle = "" # Comment decides the comment plugin used on your blog site, # available plugins: disqus, ovo. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 41351ec..ac50352 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,7 +1,7 @@ {{ partial "head.html" . }} -
+ {{ partial "header.html" . }} {{ block "main" . }} {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index b9f8629..925aa43 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -7,8 +7,8 @@ {{ end }}{{ .Description | markdownify | safeHTML }}
+ {{ if .Params.toc }} + {{ partial "toc.html" . }} + {{ end }}