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:
push:
paths: [ '**.js' ]
paths: ["**.js"]
pull_request:
paths: [ '**.js' ]
paths: ["**.js"]
schedule:
- cron: '0 0 * * 5'
- cron: "0 0 * * 5"
jobs:
analyze:
@ -20,25 +20,25 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: '${{ matrix.language }}'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: "${{ matrix.language }}"
# 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)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# 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)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{ matrix.language }}'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"

View file

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

View file

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

View file

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

View file

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

View file

@ -2,28 +2,28 @@
* The syntax highlight.
*/
@import "colors/light-syntax";
@import "colors/dark-syntax";
@import 'colors/light-syntax';
@import 'colors/dark-syntax';
html {
@media (prefers-color-scheme: light) {
&:not([data-mode]),
&[data-mode="light"] {
&[data-mode='light'] {
@include light-syntax;
}
&[data-mode="dark"] {
&[data-mode='dark'] {
@include dark-syntax;
}
}
@media (prefers-color-scheme: dark) {
&:not([data-mode]),
&[data-mode="dark"] {
&[data-mode='dark'] {
@include dark-syntax;
}
&[data-mode="light"] {
&[data-mode='light'] {
@include light-syntax;
}
}
@ -68,16 +68,17 @@ html {
word-wrap: normal; /* Fixed Safari overflow-x */
/* set the dollar sign to non-selectable */
>.gp:first-child {
> .gp:first-child {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
}
table {
td pre {
overflow: visible; /* Fixed iOS safari overflow-x */
overflow: visible; /* Fixed iOS safari overflow-x */
word-break: normal; /* Fixed iOS safari linenos code break */
}
}
@ -90,12 +91,14 @@ html {
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
-ms-user-select: none;
user-select: none;
}
} /* .highlight */
code {
-webkit-hyphens: none;
-ms-hyphens: none;
hyphens: none;
&.highlighter-rouge {
@ -147,7 +150,7 @@ td.rouge-code {
/* Hide line numbers for default, console, and terminal code snippets */
div {
&[class^="highlighter-rouge"],
&[class^='highlighter-rouge'],
&.nolineno,
&.language-plaintext.highlighter-rouge,
&.language-console.highlighter-rouge,
@ -176,15 +179,14 @@ div {
$dot-size: 0.75rem;
$dot-margin: 0.5rem;
content: "";
content: '';
display: inline-block;
margin-left: 1rem;
width: $dot-size;
height: $dot-size;
border-radius: 50%;
background-color: var(--code-header-muted-color);
box-shadow:
($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
box-shadow: ($dot-size + $dot-margin) 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) {
.post-content {
> div[class^="language-"] {
> div[class^='language-'] {
@include ml-mr(-1.25rem);
border-radius: 0;

View file

@ -4,23 +4,23 @@
/* sidebar */
$sidebar-width: 260px !default; /* the basic width */
$sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */
$sidebar-width-large: 350px !default; /* screen width: >= 1650px */
$sidebar-width: 260px !default; /* the basic width */
$sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */
$sidebar-width-large: 350px !default; /* screen width: >= 1650px */
/* tabs of sidebar */
$tab-count: 5 !default; /* backward compatible (version <= 4.0.2) */
$tab-count: 5 !default; /* backward compatible (version <= 4.0.2) */
$tab-height: 3rem !default;
$tab-cursor-height: 1.6rem !default;
$cursor-width: 2px !default; /* the cursor width of the selected tab */
$cursor-width: 2px !default; /* the cursor width of the selected tab */
/* other framework sizes */
$topbar-height: 3rem !default;
$search-max-width: 210px !default;
$footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
$main-content-max-width: 1250px !default;
$bottom-min-height: 35rem !default;

View file

@ -13,10 +13,13 @@
--clipboard-checked-color: #2bcc2b;
--filepath-text-color: #bdbdbd;
pre { color: #bfbfbf; } /* override Bootstrap */
/* override Bootstrap */
pre {
color: #bfbfbf;
}
.highlight {
.gp { color: #818c96; }
.highlight .gp {
color: #818c96;
}
/* 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;
--clipboard-checked-color: #43c743;
[class^="prompt-"] {
[class^='prompt-'] {
--inline-code-bg: #fbfafa;
--highlighter-rouge-color: rgb(82, 82, 82);
}

View file

@ -8,7 +8,7 @@
$timeline-width: 4px;
%timeline {
content: "";
content: '';
width: $timeline-width;
position: relative;
float: left;
@ -37,8 +37,9 @@
top: 24px;
}
&::after { /* Year dot */
content: "";
/* Year dot */
&::after {
content: '';
display: inline-block;
position: relative;
border-radius: 50%;
@ -63,7 +64,14 @@
&:nth-child(odd) {
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 {
@ -109,7 +117,7 @@
&::before {
/* the dot before post title */
content: "";
content: '';
display: inline-block;
position: relative;
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 {
background-color: var(--categories-hover-bg);
}

View file

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