style: improve code style of SCSS & YAML

This commit is contained in:
Cotes Chung 2023-03-16 03:36:52 +08:00
parent 02b7bd5095
commit 3c7934abf0
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
12 changed files with 181 additions and 117 deletions

View file

@ -1,12 +1,12 @@
name: 'CodeQL' name: "CodeQL"
on: on:
push: push:
paths: [ '**.js' ] paths: ["**.js"]
pull_request: pull_request:
paths: [ '**.js' ] paths: ["**.js"]
schedule: schedule:
- cron: '0 0 * * 5' - cron: "0 0 * * 5"
jobs: jobs:
analyze: analyze:
@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'javascript' ] language: ["javascript"]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps: steps:
@ -31,7 +31,7 @@ jobs:
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v2
with: with:
languages: '${{ matrix.language }}' languages: "${{ matrix.language }}"
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
@ -41,4 +41,4 @@ jobs:
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v2
with: with:
category: '/language:${{ matrix.language }}' category: "/language:${{ matrix.language }}"

View file

@ -1,15 +1,15 @@
name: 'Style Lint' name: "Style Lint"
on: on:
push: push:
branches-ignore: branches-ignore:
- 'production' - "production"
- 'docs' - "docs"
paths: paths:
- '_sass/**/*.scss' - "_sass/**/*.scss"
pull_request: pull_request:
paths: paths:
- '_sass/**/*.scss' - "_sass/**/*.scss"
jobs: jobs:
stylelint: stylelint:

View file

@ -1,19 +1,18 @@
# The contact options. # The contact options.
- type: github - type: github
icon: 'fab fa-github' icon: "fab fa-github"
- type: twitter - type: twitter
icon: 'fab fa-twitter' icon: "fab fa-twitter"
- type: email - type: email
icon: 'fas fa-envelope' icon: "fas fa-envelope"
noblank: true # open link in current tab noblank: true # open link in current tab
- type: rss - type: rss
icon: 'fas fa-rss' icon: "fas fa-rss"
noblank: true noblank: true
# Uncomment and complete the url below to enable more contact options # Uncomment and complete the url below to enable more contact options
# #
# - type: mastodon # - type: mastodon

View file

@ -5,22 +5,22 @@
html { html {
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
&:not([data-mode]), &:not([data-mode]),
&[data-mode="light"] { &[data-mode='light'] {
@include light-scheme; @include light-scheme;
} }
&[data-mode="dark"] { &[data-mode='dark'] {
@include dark-scheme; @include dark-scheme;
} }
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
&:not([data-mode]), &:not([data-mode]),
&[data-mode="dark"] { &[data-mode='dark'] {
@include dark-scheme; @include dark-scheme;
} }
&[data-mode="light"] { &[data-mode='light'] {
@include light-scheme; @include light-scheme;
} }
} }
@ -32,7 +32,7 @@ body {
background: var(--body-bg); background: var(--body-bg);
color: var(--text-color); color: var(--text-color);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
font-family: "Source Sans Pro", "Microsoft Yahei", sans-serif; font-family: 'Source Sans Pro', 'Microsoft Yahei', sans-serif;
line-height: 1.75; line-height: 1.75;
} }
@ -90,7 +90,7 @@ img {
animation: fade-in 0.4s ease-in; animation: fade-in 0.4s ease-in;
} }
&[data-lqip="true"] { &[data-lqip='true'] {
&.lazyload, &.lazyload,
&.lazyloading { &.lazyloading {
-webkit-filter: blur(20px); -webkit-filter: blur(20px);
@ -98,7 +98,7 @@ img {
} }
} }
&:not([data-lqip="true"]) { &:not([data-lqip='true']) {
&.lazyload, &.lazyload,
&.lazyloading { &.lazyloading {
background: var(--img-bg); background: var(--img-bg);
@ -115,13 +115,21 @@ img {
} }
@-webkit-keyframes fade-in { @-webkit-keyframes fade-in {
from { opacity: 0; } from {
to { opacity: 1; } opacity: 0;
}
to {
opacity: 1;
}
} }
@keyframes fade-in { @keyframes fade-in {
from { opacity: 0; } from {
to { opacity: 1; } opacity: 0;
}
to {
opacity: 1;
}
} }
} }
@ -130,7 +138,7 @@ blockquote {
padding-left: 1rem; padding-left: 1rem;
color: var(--blockquote-text-color); color: var(--blockquote-text-color);
&[class^="prompt-"] { &[class^='prompt-'] {
border-left: 0; border-left: 0;
position: relative; position: relative;
padding: 1rem 1rem 1rem 3rem; padding: 1rem 1rem 1rem 3rem;
@ -153,10 +161,10 @@ blockquote {
} }
} }
@include prompt("tip", "\f0eb", "regular"); @include prompt('tip', '\f0eb', 'regular');
@include prompt("info", "\f06a"); @include prompt('info', '\f06a');
@include prompt("warning", "\f06a"); @include prompt('warning', '\f06a');
@include prompt("danger", "\f071"); @include prompt('danger', '\f071');
} }
kbd { kbd {
@ -208,7 +216,8 @@ footer {
} }
} }
i { /* fontawesome icons */ /* fontawesome icons */
i {
&.far, &.far,
&.fas { &.fas {
@extend %no-cursor; @extend %no-cursor;
@ -266,7 +275,7 @@ i { /* fontawesome icons */
} }
} }
[data-topbar-visible="true"] & > div { [data-topbar-visible='true'] & > div {
top: 6rem; top: 6rem;
} }
} }
@ -310,7 +319,7 @@ i { /* fontawesome icons */
/* [scroll-focus] added by `smooth-scroll.js` */ /* [scroll-focus] added by `smooth-scroll.js` */
&:target:not([scroll-focus]), &:target:not([scroll-focus]),
&[scroll-focus="true"] > p { &[scroll-focus='true'] > p {
background-color: var(--footnote-target-bg); background-color: var(--footnote-target-bg);
width: -moz-fit-content; width: -moz-fit-content;
width: -webkit-fit-content; width: -webkit-fit-content;
@ -331,7 +340,7 @@ i { /* fontawesome icons */
/* [scroll-focus] added by `smooth-scroll.js` */ /* [scroll-focus] added by `smooth-scroll.js` */
@at-root sup:target:not([scroll-focus]), @at-root sup:target:not([scroll-focus]),
sup[scroll-focus=true] > a#{&} { sup[scroll-focus='true'] > a#{&} {
background-color: var(--footnote-target-bg); background-color: var(--footnote-target-bg);
} }
} }
@ -476,7 +485,8 @@ i { /* fontawesome icons */
list-style-type: none; list-style-type: none;
padding-left: 0; padding-left: 0;
> i { /* checkbox icon */ /* checkbox icon */
> i {
width: 2rem; width: 2rem;
margin-left: -1.25rem; margin-left: -1.25rem;
color: var(--checkbox-color); color: var(--checkbox-color);
@ -492,7 +502,7 @@ i { /* fontawesome icons */
} }
} }
input[type="checkbox"] { input[type='checkbox'] {
margin: 0 0.5rem 0.2rem -1.3rem; margin: 0 0.5rem 0.2rem -1.3rem;
vertical-align: middle; vertical-align: middle;
} }
@ -545,7 +555,7 @@ i { /* fontawesome icons */
background: var(--img-bg); background: var(--img-bg);
&::before { &::before {
content: ""; content: '';
position: absolute; position: absolute;
background: var(--shimmer-bg); background: var(--shimmer-bg);
height: 100%; height: 100%;
@ -555,13 +565,25 @@ i { /* fontawesome icons */
} }
@-webkit-keyframes shimmer { @-webkit-keyframes shimmer {
0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); } 0% {
100% { -webkit-transform: translateX(100%); transform: translateX(100%); } -webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
100% {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
} }
@keyframes shimmer { @keyframes shimmer {
0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); } 0% {
100% { -webkit-transform: translateX(100%); transform: translateX(100%); } -webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
100% {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
} }
} }
@ -627,7 +649,8 @@ i { /* fontawesome icons */
@include no-text-decoration; @include no-text-decoration;
} }
.tooltip-inner { /* Overrided BS4 Tooltip */ /* Overrided BS4 Tooltip */
.tooltip-inner {
font-size: 0.7rem; font-size: 0.7rem;
max-width: 220px; max-width: 220px;
text-align: left; text-align: left;
@ -682,7 +705,7 @@ mjx-container {
/* --- sidebar layout --- */ /* --- sidebar layout --- */
$sidebar-display: "sidebar-display"; $sidebar-display: 'sidebar-display';
#sidebar { #sidebar {
@include pl-pr(0); @include pl-pr(0);
@ -768,6 +791,7 @@ $sidebar-display: "sidebar-display";
min-height: 3rem; /* avoid vertical shifting in multi-line words */ min-height: 3rem; /* avoid vertical shifting in multi-line words */
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
} }
@ -811,10 +835,11 @@ $sidebar-display: "sidebar-display";
width: 100%; width: 100%;
} }
&::after { /* the cursor */ /* the cursor */
&::after {
display: table; display: table;
visibility: hidden; visibility: hidden;
content: ""; content: '';
position: relative; position: relative;
right: 1px; right: 1px;
width: $cursor-width; width: $cursor-width;
@ -833,7 +858,8 @@ $sidebar-display: "sidebar-display";
@for $i from 1 through $tab-count { @for $i from 1 through $tab-count {
$offset: $tab-count - $i; $offset: $tab-count - $i;
$top: (-$offset * $tab-height) + (($tab-height - $tab-cursor-height) * 0.5); $top: (-$offset * $tab-height) +
(($tab-height - $tab-cursor-height) * 0.5);
@if $i < $tab-count { @if $i < $tab-count {
> li.active:nth-child(#{$i}), > li.active:nth-child(#{$i}),
@ -894,7 +920,7 @@ $sidebar-display: "sidebar-display";
@extend %no-cursor; @extend %no-cursor;
background-color: var(--sidebar-muted-color); background-color: var(--sidebar-muted-color);
content: ""; content: '';
width: 3px; width: 3px;
height: 3px; height: 3px;
border-radius: 50%; border-radius: 50%;
@ -937,13 +963,14 @@ $sidebar-display: "sidebar-display";
border-bottom: 1px solid rgba(0, 0, 0, 0.07); border-bottom: 1px solid rgba(0, 0, 0, 0.07);
background-color: var(--topbar-wrapper-bg); background-color: var(--topbar-wrapper-bg);
[data-topbar-visible="false"] & { [data-topbar-visible='false'] & {
top: -$topbar-height; /* same as topbar height. */ top: -$topbar-height; /* same as topbar height. */
} }
} }
#topbar { #topbar {
i { /* icons */ /* icons */
i {
color: #999999; color: #999999;
} }
@ -959,7 +986,7 @@ $sidebar-display: "sidebar-display";
span { span {
&:not(:last-child) { &:not(:last-child) {
&::after { &::after {
content: ""; content: '';
padding: 0 0.3rem; padding: 0 0.3rem;
} }
} }
@ -987,7 +1014,8 @@ $sidebar-display: "sidebar-display";
} }
} }
#search-cancel { /* 'Cancel' link */ /* 'Cancel' link */
#search-cancel {
color: var(--link-color); color: var(--link-color);
margin-left: 1rem; margin-left: 1rem;
display: none; display: none;
@ -1008,9 +1036,21 @@ $sidebar-display: "sidebar-display";
background: center; background: center;
&.form-control { &.form-control {
&::-moz-placeholder { @include input-placeholder; } &::-moz-placeholder {
&::-webkit-input-placeholder { @include input-placeholder; } @include input-placeholder;
&::placeholder { @include input-placeholder; } }
&::-webkit-input-placeholder {
@include input-placeholder;
}
&:-ms-input-placeholder {
@include input-placeholder;
}
&::-ms-input-placeholder {
@include input-placeholder;
}
&::placeholder {
@include input-placeholder;
}
} }
} }
} }
@ -1032,7 +1072,7 @@ $sidebar-display: "sidebar-display";
margin: 0 1.25rem 1rem 0; margin: 0 1.25rem 1rem 0;
&::before { &::before {
content: "#"; content: '#';
color: var(--text-muted-color); color: var(--text-muted-color);
padding-right: 0.2rem; padding-right: 0.2rem;
} }
@ -1064,7 +1104,8 @@ $sidebar-display: "sidebar-display";
margin-bottom: 1rem; margin-bottom: 1rem;
} }
i { /* icons */ /* icons */
i {
color: #818182; color: #818182;
margin-right: 0.15rem; margin-right: 0.15rem;
font-size: 80%; font-size: 80%;
@ -1262,7 +1303,9 @@ $sidebar-display: "sidebar-display";
} }
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height-mobile}) !important; min-height: calc(
100vh - #{$topbar-height} - #{$footer-height-mobile}
) !important;
h1 { h1 {
margin-top: 2.2rem; margin-top: 2.2rem;
@ -1270,7 +1313,7 @@ $sidebar-display: "sidebar-display";
} }
.post-content { .post-content {
> blockquote[class^="prompt-"] { > blockquote[class^='prompt-'] {
@include ml-mr(-1.25rem); @include ml-mr(-1.25rem);
border-radius: 0; border-radius: 0;
@ -1406,7 +1449,7 @@ $sidebar-display: "sidebar-display";
} /* max-width: 849px */ } /* max-width: 849px */
@media all and (max-width: 849px) and (orientation: portrait) { @media all and (max-width: 849px) and (orientation: portrait) {
[data-topbar-visible="false"] #topbar-wrapper { [data-topbar-visible='false'] #topbar-wrapper {
top: 0; top: 0;
} }
} }
@ -1596,7 +1639,9 @@ $sidebar-display: "sidebar-display";
} }
#search-wrapper { #search-wrapper {
margin-right: calc(#{$main-content-max-width} * 0.25 - #{$search-max-width}); margin-right: calc(
#{$main-content-max-width} * 0.25 - #{$search-max-width}
);
} }
#topbar, #topbar,
@ -1611,7 +1656,9 @@ $sidebar-display: "sidebar-display";
} }
#back-to-top { #back-to-top {
right: calc((100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem); right: calc(
(100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem
);
} }
#sidebar { #sidebar {

View file

@ -7,7 +7,7 @@
%heading { %heading {
color: var(--heading-color); color: var(--heading-color);
font-weight: 400; font-weight: 400;
font-family: Lato, "Microsoft Yahei", sans-serif; font-family: Lato, 'Microsoft Yahei', sans-serif;
} }
%section { %section {
@ -150,7 +150,7 @@
transform: translateX(-50%); transform: translateX(-50%);
} }
@mixin prompt($type, $fa-content, $fa-style: "solid") { @mixin prompt($type, $fa-content, $fa-style: 'solid') {
&.prompt-#{$type} { &.prompt-#{$type} {
background-color: var(--prompt-#{$type}-bg); background-color: var(--prompt-#{$type}-bg);

View file

@ -2,28 +2,28 @@
* The syntax highlight. * The syntax highlight.
*/ */
@import "colors/light-syntax"; @import 'colors/light-syntax';
@import "colors/dark-syntax"; @import 'colors/dark-syntax';
html { html {
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
&:not([data-mode]), &:not([data-mode]),
&[data-mode="light"] { &[data-mode='light'] {
@include light-syntax; @include light-syntax;
} }
&[data-mode="dark"] { &[data-mode='dark'] {
@include dark-syntax; @include dark-syntax;
} }
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
&:not([data-mode]), &:not([data-mode]),
&[data-mode="dark"] { &[data-mode='dark'] {
@include dark-syntax; @include dark-syntax;
} }
&[data-mode="light"] { &[data-mode='light'] {
@include light-syntax; @include light-syntax;
} }
} }
@ -71,6 +71,7 @@ html {
> .gp:first-child { > .gp:first-child {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
} }
} }
@ -90,12 +91,14 @@ html {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-o-user-select: none; -o-user-select: none;
-ms-user-select: none;
user-select: none; user-select: none;
} }
} /* .highlight */ } /* .highlight */
code { code {
-webkit-hyphens: none; -webkit-hyphens: none;
-ms-hyphens: none;
hyphens: none; hyphens: none;
&.highlighter-rouge { &.highlighter-rouge {
@ -147,7 +150,7 @@ td.rouge-code {
/* Hide line numbers for default, console, and terminal code snippets */ /* Hide line numbers for default, console, and terminal code snippets */
div { div {
&[class^="highlighter-rouge"], &[class^='highlighter-rouge'],
&.nolineno, &.nolineno,
&.language-plaintext.highlighter-rouge, &.language-plaintext.highlighter-rouge,
&.language-console.highlighter-rouge, &.language-console.highlighter-rouge,
@ -176,15 +179,14 @@ div {
$dot-size: 0.75rem; $dot-size: 0.75rem;
$dot-margin: 0.5rem; $dot-margin: 0.5rem;
content: ""; content: '';
display: inline-block; display: inline-block;
margin-left: 1rem; margin-left: 1rem;
width: $dot-size; width: $dot-size;
height: $dot-size; height: $dot-size;
border-radius: 50%; border-radius: 50%;
background-color: var(--code-header-muted-color); background-color: var(--code-header-muted-color);
box-shadow: box-shadow: ($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color); ($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color);
} }
@ -256,7 +258,7 @@ div {
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
.post-content { .post-content {
> div[class^="language-"] { > div[class^='language-'] {
@include ml-mr(-1.25rem); @include ml-mr(-1.25rem);
border-radius: 0; border-radius: 0;

View file

@ -13,10 +13,13 @@
--clipboard-checked-color: #2bcc2b; --clipboard-checked-color: #2bcc2b;
--filepath-text-color: #bdbdbd; --filepath-text-color: #bdbdbd;
pre { color: #bfbfbf; } /* override Bootstrap */ /* override Bootstrap */
pre {
color: #bfbfbf;
}
.highlight { .highlight .gp {
.gp { color: #818c96; } color: #818c96;
} }
/* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */ /* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */

View file

@ -76,7 +76,7 @@
--code-header-icon-color: #d1d1d1; --code-header-icon-color: #d1d1d1;
--clipboard-checked-color: #43c743; --clipboard-checked-color: #43c743;
[class^="prompt-"] { [class^='prompt-'] {
--inline-code-bg: #fbfafa; --inline-code-bg: #fbfafa;
--highlighter-rouge-color: rgb(82, 82, 82); --highlighter-rouge-color: rgb(82, 82, 82);
} }

View file

@ -8,7 +8,7 @@
$timeline-width: 4px; $timeline-width: 4px;
%timeline { %timeline {
content: ""; content: '';
width: $timeline-width; width: $timeline-width;
position: relative; position: relative;
float: left; float: left;
@ -37,8 +37,9 @@
top: 24px; top: 24px;
} }
&::after { /* Year dot */ /* Year dot */
content: ""; &::after {
content: '';
display: inline-block; display: inline-block;
position: relative; position: relative;
border-radius: 50%; border-radius: 50%;
@ -63,7 +64,14 @@
&:nth-child(odd) { &:nth-child(odd) {
background-color: var(--main-bg, #ffffff); background-color: var(--main-bg, #ffffff);
background-image: linear-gradient(to left, #ffffff, #fbfbfb, #fbfbfb, #fbfbfb, #ffffff); background-image: linear-gradient(
to left,
#ffffff,
#fbfbfb,
#fbfbfb,
#fbfbfb,
#ffffff
);
} }
&::before { &::before {
@ -109,7 +117,7 @@
&::before { &::before {
/* the dot before post title */ /* the dot before post title */
content: ""; content: '';
display: inline-block; display: inline-block;
position: relative; position: relative;
border-radius: 50%; border-radius: 50%;

View file

@ -54,7 +54,8 @@
} }
} }
@media (hover: hover) { /* only works on desktop */ /* only works on desktop */
@media (hover: hover) {
.category-trigger:hover { .category-trigger:hover {
background-color: var(--categories-hover-bg); background-color: var(--categories-hover-bg);
} }

View file

@ -13,31 +13,35 @@
line-height: 1.5rem; line-height: 1.5rem;
padding: 0.6rem 0; padding: 0.6rem 0;
&::before { /* dot */ /* dot */
&::before {
background: #999999; background: #999999;
width: 5px; width: 5px;
height: 5px; height: 5px;
border-radius: 50%; border-radius: 50%;
display: block; display: block;
content: ""; content: '';
position: relative; position: relative;
top: 0.6rem; top: 0.6rem;
margin-right: 0.5rem; margin-right: 0.5rem;
} }
> a { /* post's title */ /* post's title */
> a {
@extend %no-bottom-border; @extend %no-bottom-border;
font-size: 1.1rem; font-size: 1.1rem;
} }
/* post's date */
> span:last-child { > span:last-child {
white-space: nowrap; white-space: nowrap;
} /* post's date */ }
} }
} }
#page-tag h1 > i { /* tag icon */ /* tag icon */
#page-tag h1 > i {
font-size: 1.2rem; font-size: 1.2rem;
} }