From d3535f6a1665a7d265912151d78081a238b547da Mon Sep 17 00:00:00 2001 From: PCloud Date: Thu, 16 May 2024 14:24:19 +0100 Subject: [PATCH] refactor: prettier format --- .eslintrc.js | 15 - .github/ISSUE_TEMPLATE/bug-report.yml | 4 +- .github/ISSUE_TEMPLATE/feature-request.yml | 32 +- .github/dependabot.yml | 1 - .github/release.yml | 2 +- .github/workflows/Lighthouse-CI.yml | 4 +- .github/workflows/build.yml | 6 +- .github/workflows/codeql-analysis.yml | 56 +- .github/workflows/pages.yml | 2 +- .../workflows/update-algolia-search-index.yml | 18 +- .github/workflows/update-dependencies.yml | 2 +- .prettierignore | 5 + .prettierrc | 1 + assets/css/_core/_base.scss | 80 +- assets/css/_core/_media.scss | 8 +- assets/css/_mixin/_compatibility.scss | 8 +- assets/css/_mixin/_link.scss | 4 +- assets/css/_page/_home.scss | 35 +- assets/css/_page/_single.scss | 86 +- assets/css/_page/_special.scss | 3 +- assets/css/_page/_taxonomy.scss | 13 +- assets/css/_partial/_archive/_terms.scss | 11 +- assets/css/_partial/_cookieconsent.scss | 3 +- assets/css/_partial/_fixed-button.scss | 9 +- assets/css/_partial/_footer.scss | 2 +- assets/css/_partial/_header.scss | 53 +- assets/css/_partial/_icon.scss | 4 +- assets/css/_partial/_mask.scss | 2 +- assets/css/_partial/_pagination.scss | 6 +- assets/css/_partial/_single/_admonition.scss | 31 +- assets/css/_partial/_single/_code.scss | 14 +- assets/css/_partial/_single/_echarts.scss | 2 +- assets/css/_partial/_single/_footer.scss | 10 +- assets/css/_partial/_single/_friend.scss | 106 +- assets/css/_partial/_single/_katex.scss | 8 +- assets/css/_partial/_single/_mapbox.scss | 4 +- assets/css/_partial/_single/_mermaid.scss | 14 +- assets/css/_partial/_single/_music.scss | 2 +- assets/css/_partial/_single/_related.scss | 95 +- assets/css/_partial/_single/_series.scss | 98 +- assets/css/_partial/_single/_showcase.scss | 111 +- assets/css/_partial/_single/_sponsor.scss | 88 +- assets/css/_partial/_single/_toc.scss | 27 +- assets/css/_variables.scss | 194 +-- assets/css/tailwind.css | 16 +- assets/css/themes/_themes.scss | 2 +- assets/css/themes/code-map.scss | 442 ++---- .../css/themes/syntax-catppuccin-latte.scss | 456 ++++-- assets/css/themes/syntax-onedark.scss | 438 ++++-- assets/data/emoji/apple.yml | 4 +- assets/data/emoji/facebook.yml | 4 +- assets/data/emoji/google.yml | 4 +- assets/data/emoji/twitter.yml | 4 +- assets/data/social.yml | 2 +- assets/js/lib/aplayer.js | 23 +- assets/js/lib/artalk.js | 14 +- assets/js/lib/cookieconsent.js | 8 +- assets/js/lib/echarts.js | 33 +- assets/js/lib/giscus.js | 63 +- assets/js/lib/gitalk.js | 6 +- assets/js/lib/katex.js | 8 +- assets/js/lib/mathjax.js | 14 +- assets/js/lib/remark42.js | 32 +- assets/js/lib/twemoji.js | 4 +- assets/js/lib/twikoo.js | 43 +- assets/js/lib/utterances.js | 42 +- assets/js/lib/valine.js | 4 +- assets/js/lib/vssue.js | 27 +- assets/js/lib/waline.js | 4 +- assets/js/shims/aplayer.js | 2 +- assets/js/shims/artalk.js | 2 +- assets/js/shims/cookieconsent.js | 2 +- assets/js/shims/echarts.js | 2 +- assets/js/shims/katex.js | 2 +- assets/js/shims/tablesort.js | 2 +- assets/js/shims/twemoji.js | 2 +- assets/js/shims/twikoo.js | 2 +- assets/js/shims/valine.js | 2 +- assets/js/shims/waline.js | 2 +- assets/js/sw.js | 444 +++--- assets/js/theme.ts | 1217 +++++++++-------- dependencies.json | 234 ++-- exampleSite/schema.json | 63 +- exampleSite/static/site.webmanifest | 54 +- package.json | 3 +- 85 files changed, 2769 insertions(+), 2242 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 3de089cd9..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - env: { - browser: true, - commonjs: true, - es2021: true - }, - extends: [ - 'standard' - ], - parserOptions: { - ecmaVersion: 'latest' - }, - rules: { - } -} diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 3fd1e8c1e..0faab6eea 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -20,7 +20,7 @@ body: attributes: label: Screenshots 屏幕截图 description: | - If applicable, add screenshots to help explain your problem. 如果可以的话, 提供屏幕截图对解决问题很有帮助. + If applicable, add screenshots to help explain your problem. 如果可以的话, 提供屏幕截图对解决问题很有帮助. - type: textarea id: environment attributes: @@ -30,7 +30,7 @@ body: placeholder: | - OS: [e.g. Windows 10, macOS, Ubuntu] - Theme version/commit [e.g. 0.2.0, 2ccba79] - - Hugo version [e.g. 0.69.0] + - Hugo version [e.g. 0.69.0] - type: textarea id: preview attributes: diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index 3b5a6d709..7cd3c989c 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -3,19 +3,19 @@ description: "Suggest an idea for this project 为这个项目提供一个建议 title: "[FEATURE] Some feature" labels: ["new feature"] body: - - type: textarea - id: describe - attributes: - label: Describe the feature you want 描述你的功能需求 - description: | - Please submit new issues for different features. - 请针对不同的功能建议提交新的 issue. - placeholder: | - I recommend adding this feature. - 我希望添加这样的一个功能... - - type: textarea - id: reference - attributes: - label: Useful reference 有价值的参考 - description: | - If available, provide useful links to fulfill the feature. 如果可以的话, 提供实现这个功能的相关参考链接. + - type: textarea + id: describe + attributes: + label: Describe the feature you want 描述你的功能需求 + description: | + Please submit new issues for different features. + 请针对不同的功能建议提交新的 issue. + placeholder: | + I recommend adding this feature. + 我希望添加这样的一个功能... + - type: textarea + id: reference + attributes: + label: Useful reference 有价值的参考 + description: | + If available, provide useful links to fulfill the feature. 如果可以的话, 提供实现这个功能的相关参考链接. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b9dcfa5d1..4a7dbc2c3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,4 +15,3 @@ updates: schedule: interval: "daily" open-pull-requests-limit: 1000 - diff --git a/.github/release.yml b/.github/release.yml index a6f6d4d3c..b6f316b75 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -19,4 +19,4 @@ changelog: - bug - title: Other Changes labels: - - "*" \ No newline at end of file + - "*" diff --git a/.github/workflows/Lighthouse-CI.yml b/.github/workflows/Lighthouse-CI.yml index 89cbe9336..4714aac81 100644 --- a/.github/workflows/Lighthouse-CI.yml +++ b/.github/workflows/Lighthouse-CI.yml @@ -2,7 +2,7 @@ name: Lighthouse-CI -# Controls when the action will run. +# Controls when the action will run. on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -22,7 +22,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: - hugo-version: 'latest' + hugo-version: "latest" extended: true - name: npm install, build run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ebdb900c..330d58e78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] workflow_dispatch: jobs: @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: '16' + node-version: "16" - name: Install dependencies run: npm install diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 64880cc1a..b93d09466 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,9 +14,9 @@ name: "CodeQL" on: pull_request: # The branches below must be a subset of the branches above - branches: [ main ] + branches: [main] schedule: - - cron: '45 0 * * 1' + - cron: "45 0 * * 1" jobs: analyze: @@ -26,40 +26,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, 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@v3 + # Autobuild attempts to build any compiled languages (C/C++, C#, 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@v3 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3a586820c..a7734d661 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: - hugo-version: 'latest' + hugo-version: "latest" extended: true - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/update-algolia-search-index.yml b/.github/workflows/update-algolia-search-index.yml index a4bc559ac..a60b28ce2 100644 --- a/.github/workflows/update-algolia-search-index.yml +++ b/.github/workflows/update-algolia-search-index.yml @@ -12,26 +12,26 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: - hugo-version: 'latest' + hugo-version: "latest" extended: true - name: Build run: | - npm install - npm run build + npm install + npm run build - name: Update Algolia Index (en) env: ALGOLIA_APP_ID: 5YGRNRQK1G ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} - ALGOLIA_INDEX_NAME: 'en_index' - ALGOLIA_INDEX_FILE: './exampleSite/public/index.json' + ALGOLIA_INDEX_NAME: "en_index" + ALGOLIA_INDEX_FILE: "./exampleSite/public/index.json" run: | npm run algolia @@ -39,7 +39,7 @@ jobs: env: ALGOLIA_APP_ID: 5YGRNRQK1G ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} - ALGOLIA_INDEX_NAME: 'zh_cn_index' - ALGOLIA_INDEX_FILE: './exampleSite/public/zh-cn/index.json' + ALGOLIA_INDEX_NAME: "zh_cn_index" + ALGOLIA_INDEX_FILE: "./exampleSite/public/zh-cn/index.json" run: | npm run algolia diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 1a4bc21bd..eb99c7fce 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -13,7 +13,7 @@ jobs: with: submodules: true fetch-depth: 0 - + - uses: Hugo-DoIt/update-dependencies@v0.3.1 with: reviewers: | diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..c2fa97ea6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +assets/lib +*.html +*.md +**/public +main.css diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/assets/css/_core/_base.scss b/assets/css/_core/_base.scss index a72287406..3547f0598 100644 --- a/assets/css/_core/_base.scss +++ b/assets/css/_core/_base.scss @@ -1,40 +1,40 @@ -html { - font-family: $global-font-family; - font-weight: $global-font-weight; - font-display: swap; - font-size: $global-font-size; - line-height: $global-line-height; - width:100%; - scroll-behavior: smooth; - overflow: overlay; -} - -@media screen and (prefers-reduced-motion: reduce) { - html { - scroll-behavior: auto; - } -} - -::selection { - background-color: $selection-color; -} - -body { - background-color: $global-background-color; - color: $global-font-color; - @include overflow-wrap(break-word); - scrollbar-color: auto; -} - -@include ms; -@include link(true, true); - -@import "../_partial/mask"; -@import "../_partial/icon"; -@import "../_partial/details"; -@import "../_partial/fixed-button"; -@import "../_partial/cookieconsent"; - -img { - object-fit: cover; -} +html { + font-family: $global-font-family; + font-weight: $global-font-weight; + font-display: swap; + font-size: $global-font-size; + line-height: $global-line-height; + width: 100%; + scroll-behavior: smooth; + overflow: overlay; +} + +@media screen and (prefers-reduced-motion: reduce) { + html { + scroll-behavior: auto; + } +} + +::selection { + background-color: $selection-color; +} + +body { + background-color: $global-background-color; + color: $global-font-color; + @include overflow-wrap(break-word); + scrollbar-color: auto; +} + +@include ms; +@include link(true, true); + +@import "../_partial/mask"; +@import "../_partial/icon"; +@import "../_partial/details"; +@import "../_partial/fixed-button"; +@import "../_partial/cookieconsent"; + +img { + object-fit: cover; +} diff --git a/assets/css/_core/_media.scss b/assets/css/_core/_media.scss index 3240e28b5..2d21ba8c7 100644 --- a/assets/css/_core/_media.scss +++ b/assets/css/_core/_media.scss @@ -14,8 +14,8 @@ } #toc-auto { - left: 76%; - width: 24%; + left: 76%; + width: 24%; } #header-desktop .header-wrapper { @@ -65,7 +65,9 @@ margin-left: auto !important; padding-top: $header-height; - .categories-card, .author-card, .series-card { + .categories-card, + .author-card, + .series-card { .card-item { width: 100%; } diff --git a/assets/css/_mixin/_compatibility.scss b/assets/css/_mixin/_compatibility.scss index 19e32a029..5c416a320 100644 --- a/assets/css/_mixin/_compatibility.scss +++ b/assets/css/_mixin/_compatibility.scss @@ -47,19 +47,19 @@ } @mixin placeholder($color) { - input::-webkit-input-placeholder{ + input::-webkit-input-placeholder { color: $color; } - input:-moz-placeholder{ + input:-moz-placeholder { color: $color; } - input::-moz-placeholder{ + input::-moz-placeholder { color: $color; } - input:-ms-input-placeholder{ + input:-ms-input-placeholder { color: $color; } diff --git a/assets/css/_mixin/_link.scss b/assets/css/_mixin/_link.scss index 9cd00c494..18de95546 100644 --- a/assets/css/_mixin/_link.scss +++ b/assets/css/_mixin/_link.scss @@ -1,5 +1,7 @@ @mixin link($light, $dark) { - a, a::before, a::after { + a, + a::before, + a::after { text-decoration: none; color: if($light, $global-link-color, $single-link-color); diff --git a/assets/css/_page/_home.scss b/assets/css/_page/_home.scss index 17f9a5e76..d417dcf6d 100644 --- a/assets/css/_page/_home.scss +++ b/assets/css/_page/_home.scss @@ -1,11 +1,11 @@ .home { .home-profile { - @include transform(translateY( 16vh)); - padding: 0 0 .5rem; + @include transform(translateY(16vh)); + padding: 0 0 0.5rem; text-align: center; .home-avatar { - padding: .5rem; + padding: 0.5rem; img { display: inline-block; @@ -13,12 +13,12 @@ height: auto; margin: 0 auto; @include border-radius(100%); - @include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05)); + @include box-shadow(0 0 0 0.3618em rgba(0, 0, 0, 0.05)); @include transition(all 0.4s ease); &:hover { position: relative; - @include transform(translateY(-.75rem)); + @include transform(translateY(-0.75rem)); } } } @@ -27,18 +27,18 @@ font-size: 1.25rem; font-weight: bold; margin: 0; - padding: .5rem; + padding: 0.5rem; } .home-subtitle { font-size: 1rem; font-weight: normal; margin: 0; - padding: .5rem; + padding: 0.5rem; } .links { - padding: .5rem; + padding: 0.5rem; font-size: 1.5rem; a * { @@ -47,7 +47,7 @@ img { height: 1.5rem; - padding: 0 .25rem; + padding: 0 0.25rem; } } @@ -56,7 +56,7 @@ line-height: 1.5rem; font-weight: normal; margin: 0; - padding: .5rem; + padding: 0.5rem; color: $global-font-secondary-color; } } @@ -74,7 +74,7 @@ .summary { padding-top: 1rem; - padding-bottom: .8rem; + padding-bottom: 0.8rem; color: $global-font-color; border-bottom: 3px dashed $global-border-color; @@ -91,10 +91,9 @@ height: 100%; left: 0; top: 0; - object-fit: cover + object-fit: cover; } - &:hover { @include transform(scale(1.01)); } @@ -108,14 +107,13 @@ .content { @include box(vertical); - margin-top: .3rem; + margin-top: 0.3rem; width: 100%; overflow: hidden; text-overflow: ellipsis; @include overflow-wrap(break-word); color: $global-font-secondary-color; - h2, h3, h4, @@ -138,17 +136,18 @@ @include link(false, true); - b, strong { + b, + strong { color: $global-font-secondary-color; } } .post-footer { - margin-top: .4rem; + margin-top: 0.4rem; display: flex; justify-content: space-between; align-items: center; - font-size: .875rem; + font-size: 0.875rem; @include link(false, false); diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 0e4080280..35d5ca178 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -3,14 +3,14 @@ .single { .single-title { - margin: 1rem 0 .5rem; + margin: 1rem 0 0.5rem; font-size: 1.6rem; font-weight: bold; line-height: 140%; } .single-subtitle { - margin: .4rem 0; + margin: 0.4rem 0; font-size: 1.2rem; font-weight: normal; font-style: italic; @@ -18,7 +18,7 @@ } .post-meta { - font-size: .875rem; + font-size: 0.875rem; color: $global-font-secondary-color; span { @@ -33,7 +33,7 @@ } .featured-image { - margin: .5rem 0 1rem 0; + margin: 0.5rem 0 1rem 0; img { display: block; @@ -43,11 +43,10 @@ margin: 0 auto; overflow: hidden; } - } .content { - >h2 { + > h2 { font-size: 1.5rem; & code { @@ -55,7 +54,7 @@ } } - >h3 { + > h3 { font-size: 1.375rem; & code { @@ -63,7 +62,7 @@ } } - >h4 { + > h4 { font-size: 1.25rem; & code { @@ -71,11 +70,11 @@ } } - >h5 { + > h5 { font-size: 1.125rem; } - >h6 { + > h6 { font-size: 1rem; } @@ -88,24 +87,24 @@ margin: 1.2rem 0; } - >h2, - >h3, - >h4, - >h5, - >h6 { - >.header-mark::before { + > h2, + > h3, + > h4, + > h5, + > h6 { + > .header-mark::before { content: "|"; - margin-right: .3125rem; + margin-right: 0.3125rem; color: $single-link-color; } } - >h2>.header-mark::before { + > h2 > .header-mark::before { content: "|"; } p { - margin: .5rem 0; + margin: 0.5rem 0; } b, @@ -125,7 +124,6 @@ } } - a:hover b, a:hover strong { color: $single-link-hover-color; @@ -133,7 +131,7 @@ ul, ol { - margin: .5rem 0; + margin: 0.5rem 0; padding-left: 2.5rem; } @@ -147,16 +145,15 @@ rt { color: $global-font-secondary-color; } - } .table-wrapper { overflow-x: auto; - >table { + > table { width: 100%; max-width: 100%; - margin: .625rem 0; + margin: 0.625rem 0; border-spacing: 0; background: $table-background-color; border-collapse: collapse; @@ -174,19 +171,18 @@ th, td { - padding: .3rem 1rem; + padding: 0.3rem 1rem; border: 1px solid $table-border-color; - } - th[role=columnheader]:not(.no-sort) { + th[role="columnheader"]:not(.no-sort) { cursor: pointer; } - th[role=columnheader]:not(.no-sort):after { - content: ''; + th[role="columnheader"]:not(.no-sort):after { + content: ""; float: right; - margin: .7rem -.5rem 0px .5rem; + margin: 0.7rem -0.5rem 0px 0.5rem; border-width: 0 4px 4px; border-style: solid; border-color: $global-font-color transparent; @@ -199,7 +195,7 @@ user-select: none; } - th[aria-sort=ascending]:not(.no-sort):after { + th[aria-sort="ascending"]:not(.no-sort):after { border-bottom: none; border-width: 4px 4px 0; } @@ -209,7 +205,7 @@ opacity: 0.4; } - th[role=columnheader]:not(.no-sort):hover:after { + th[role="columnheader"]:not(.no-sort):hover:after { visibility: visible; opacity: 1; } @@ -222,16 +218,16 @@ } figure { - margin: .5rem; + margin: 0.5rem; text-align: center; .image-caption:not(:empty) { min-width: 20%; max-width: 80%; display: inline-block; - padding: .5rem; + padding: 0.5rem; margin: 0 auto; - font-size: .875rem; + font-size: 0.875rem; color: #969696; } @@ -245,18 +241,17 @@ blockquote { display: block; - border-left: .25rem solid $blockquote-color; + border-left: 0.25rem solid $blockquote-color; background-color: $blockquote-bg-color; - padding: .25rem .75rem; + padding: 0.25rem 0.75rem; margin: 1rem 0; - } .footnotes { color: $global-font-secondary-color; p { - margin: .25rem 0; + margin: 0.25rem 0; } li { @@ -289,21 +284,19 @@ position: relative; border-top: 3px dashed $global-border-color; border-bottom: none; - } kbd { display: inline-block; - padding: .25rem; + padding: 0.25rem; background-color: $global-background-color; border: 1px solid $global-border-color; border-bottom-color: $global-border-color; @include border-radius(3px); @include box-shadow(inset 0 -1px 0 $global-border-color); - font-size: .8rem; + font-size: 0.8rem; font-family: $code-font-family; color: $code-color; - } .version { @@ -321,8 +314,8 @@ .typeit { .highlight { - padding: .375rem; - font-size: .875rem; + padding: 0.375rem; + font-size: 0.875rem; font-family: $code-font-family; word-break: break-all; white-space: pre-wrap; @@ -334,7 +327,6 @@ --ti-cursor-line-height: #{$global-line-height}; --ti-cursor-color: #{$global-font-secondary-color}; --ti-cursor-margin-left: 0; - } .lg-toolbar .lg-icon::after { @@ -344,4 +336,4 @@ #TableOfContents { max-height: 75vh; overflow: auto; -} \ No newline at end of file +} diff --git a/assets/css/_page/_special.scss b/assets/css/_page/_special.scss index 436d8d959..3a8f18d26 100644 --- a/assets/css/_page/_special.scss +++ b/assets/css/_page/_special.scss @@ -1,5 +1,6 @@ .special { - .single-title, .single-subtitle { + .single-title, + .single-subtitle { text-align: right; } } diff --git a/assets/css/_page/_taxonomy.scss b/assets/css/_page/_taxonomy.scss index 07df2ef5c..6aca3d69d 100644 --- a/assets/css/_page/_taxonomy.scss +++ b/assets/css/_page/_taxonomy.scss @@ -1,8 +1,7 @@ .introduction blockquote { - display: block; - border-left: .25rem solid $blockquote-color; - background-color: $blockquote-bg-color; - padding: .25rem .75rem; - margin: 1rem 0; - -} \ No newline at end of file + display: block; + border-left: 0.25rem solid $blockquote-color; + background-color: $blockquote-bg-color; + padding: 0.25rem 0.75rem; + margin: 1rem 0; +} diff --git a/assets/css/_partial/_archive/_terms.scss b/assets/css/_partial/_archive/_terms.scss index e0c344db0..bba8325da 100644 --- a/assets/css/_partial/_archive/_terms.scss +++ b/assets/css/_partial/_archive/_terms.scss @@ -1,4 +1,6 @@ -.categories-card, .author-card, .series-card { +.categories-card, +.author-card, +.series-card { margin: 0 auto; margin-top: 3rem; display: flex; @@ -9,7 +11,7 @@ line-height: 1.6rem; .card-item { - font-size: .875rem; + font-size: 0.875rem; text-align: left; width: 45%; display: flex; @@ -28,7 +30,7 @@ font-weight: bold; display: inline-block; margin-top: 1rem; - margin-bottom: .75rem; + margin-bottom: 0.75rem; } span { @@ -44,7 +46,7 @@ justify-content: space-between; align-items: center; box-sizing: border-box; - margin: .25rem 0 .25rem 1.5rem; + margin: 0.25rem 0 0.25rem 1.5rem; } .archive-item-link { @@ -59,7 +61,6 @@ color: $global-link-hover-color; background-color: transparent; } - } .archive-item-date { diff --git a/assets/css/_partial/_cookieconsent.scss b/assets/css/_partial/_cookieconsent.scss index 94296aad1..e38ee4c4d 100644 --- a/assets/css/_partial/_cookieconsent.scss +++ b/assets/css/_partial/_cookieconsent.scss @@ -2,7 +2,8 @@ .cc-btn { color: $global-font-color; - &:hover, &:focus { + &:hover, + &:focus { background-color: $cookie-background-color; } } diff --git a/assets/css/_partial/_fixed-button.scss b/assets/css/_partial/_fixed-button.scss index 6cec2ac7a..b0f3140fd 100644 --- a/assets/css/_partial/_fixed-button.scss +++ b/assets/css/_partial/_fixed-button.scss @@ -4,17 +4,20 @@ right: 1.5rem; font-size: 1rem; line-height: 1.3rem; - padding: .6rem .6rem; + padding: 0.6rem 0.6rem; color: $global-font-secondary-color; // background: $global-border-color; // 原 light $global-border-color dark,black $header-background-color background: $header-background-color; @include border-radius(2rem); @include blur; - &:hover, &:active { + &:hover, + &:active { color: $global-font-color; } - &:active, &:focus, &:hover { + &:active, + &:focus, + &:hover { outline: none; } } diff --git a/assets/css/_partial/_footer.scss b/assets/css/_partial/_footer.scss index 731b0b4fa..39e0b59a1 100644 --- a/assets/css/_partial/_footer.scss +++ b/assets/css/_partial/_footer.scss @@ -6,7 +6,7 @@ footer { padding: 1rem 0; .footer-container { - font-size: .875rem; + font-size: 0.875rem; .footer-line { width: 100%; diff --git a/assets/css/_partial/_header.scss b/assets/css/_partial/_header.scss index e09f287c3..d65a1f708 100644 --- a/assets/css/_partial/_header.scss +++ b/assets/css/_partial/_header.scss @@ -11,16 +11,17 @@ header { vertical-align: text-bottom; } - .logo, .header-title-pre { - padding-right: .25rem; + .logo, + .header-title-pre { + padding-right: 0.25rem; } .header-title-post { - padding-left: .25rem; + padding-left: 0.25rem; } &:hover { - @include box-shadow(0 0 1.5rem 0 rgba(0, 0, 0, .1)); + @include box-shadow(0 0 1.5rem 0 rgba(0, 0, 0, 0.1)); } } @@ -35,7 +36,7 @@ header { .header-title { font-family: $header-title-font-family; font-weight: bold; - margin-right: .5rem; + margin-right: 0.5rem; min-width: 10%; overflow: hidden; white-space: nowrap; @@ -81,7 +82,7 @@ header { box-sizing: border-box; height: 2.5rem; width: 2.5rem; - @include border-radius(.5rem); + @include border-radius(0.5rem); border: none; outline: none; background-color: $header-background-color; @@ -102,7 +103,7 @@ header { } .search-toggle { - left: .5rem; + left: 0.5rem; right: auto; } @@ -114,7 +115,8 @@ header { display: none; } - .open &, &.mobile { + .open &, + &.mobile { input { color: $global-font-color; background-color: $search-background-color; @@ -167,7 +169,7 @@ header { } .menu-item { - margin: 0 .5rem; + margin: 0 0.5rem; &.delimiter { border-left: 1.5px solid $global-font-color; @@ -183,7 +185,7 @@ header { } &.search { - margin: 0 -.5rem 0 0; + margin: 0 -0.5rem 0 0; } } @@ -195,7 +197,7 @@ header { } &.open .header-wrapper .menu .menu-item.search { - margin: 0 .25rem 0 .5rem; + margin: 0 0.25rem 0 0.5rem; input { width: 24rem; @@ -238,24 +240,24 @@ header { } span:nth-child(1) { - margin-bottom: .5rem; + margin-bottom: 0.5rem; } span:nth-child(3) { - margin-top: .5rem; + margin-top: 0.5rem; } &.active { span:nth-child(1) { - @include transform(rotate(45deg) translate(.4rem, .5rem)); + @include transform(rotate(45deg) translate(0.4rem, 0.5rem)); } span:nth-child(2) { - opacity: 0 + opacity: 0; } span:nth-child(3) { - @include transform(rotate(-45deg) translate(.4rem, -.5rem)); + @include transform(rotate(-45deg) translate(0.4rem, -0.5rem)); } } } @@ -266,8 +268,8 @@ header { background: $header-background-color; border-top: 2px solid $global-border-color; display: none; - padding-top: .5rem; - @include box-shadow(0 .125rem .25rem rgba(0, 0, 0, .1)); + padding-top: 0.5rem; + @include box-shadow(0 0.125rem 0.25rem rgba(0, 0, 0, 0.1)); .search-wrapper { display: flex; @@ -281,7 +283,8 @@ header { .search { flex-grow: 10; - .algolia-autocomplete, input { + .algolia-autocomplete, + input { width: 100%; } } @@ -292,7 +295,7 @@ header { .search-cancel { display: none; - margin-left: .75rem; + margin-left: 0.75rem; } .menu-item { @@ -330,7 +333,7 @@ header { position: fixed; z-index: 200; top: $header-height; - @include box-shadow(0 .125rem .25rem rgba(0, 0, 0, .1)); + @include box-shadow(0 0.125rem 0.25rem rgba(0, 0, 0, 0.1)); &.desktop { right: 2rem; @@ -351,7 +354,7 @@ header { max-height: calc(100vh - #{$header-height}); .suggestion { - padding: .75rem 1rem; + padding: 0.75rem 1rem; .suggestion-title { display: inline-block; @@ -368,7 +371,7 @@ header { } .suggestion-date { - font-size: .875rem; + font-size: 0.875rem; float: right; text-align: right; color: $global-font-secondary-color; @@ -410,9 +413,9 @@ header { } .search-footer { - padding: .5rem 1rem; + padding: 0.5rem 1rem; float: right; - font-size: .8rem; + font-size: 0.8rem; color: $global-font-secondary-color; @include link(false, false); diff --git a/assets/css/_partial/_icon.scss b/assets/css/_partial/_icon.scss index 362529e3b..37cc1dc55 100644 --- a/assets/css/_partial/_icon.scss +++ b/assets/css/_partial/_icon.scss @@ -12,8 +12,8 @@ svg.icon { img.emoji { height: 1em; width: 1em; - margin: 0 .05em 0 .1em; - vertical-align: -.1em; + margin: 0 0.05em 0 0.1em; + vertical-align: -0.1em; display: inline-block !important; } diff --git a/assets/css/_partial/_mask.scss b/assets/css/_partial/_mask.scss index 65b5734a6..32cf99116 100644 --- a/assets/css/_partial/_mask.scss +++ b/assets/css/_partial/_mask.scss @@ -11,6 +11,6 @@ .blur & { z-index: 100; - background-color: rgba(0, 0, 0, .25); + background-color: rgba(0, 0, 0, 0.25); } } diff --git a/assets/css/_partial/_pagination.scss b/assets/css/_partial/_pagination.scss index 6294cab95..d572d3bc6 100644 --- a/assets/css/_partial/_pagination.scss +++ b/assets/css/_partial/_pagination.scss @@ -8,9 +8,9 @@ padding: 1rem 0 0; a { - font-size: .8rem; + font-size: 0.8rem; color: $global-font-secondary-color; - letter-spacing: .1rem; + letter-spacing: 0.1rem; font-weight: 700; padding: 5px 5px; text-decoration: none; @@ -32,7 +32,6 @@ color: $pagination-link-hover-color; } - &:before, &:after { position: absolute; @@ -58,7 +57,6 @@ } &:hover { - &:before, &:after { width: 50%; diff --git a/assets/css/_partial/_single/_admonition.scss b/assets/css/_partial/_single/_admonition.scss index f57190da8..e7d747299 100644 --- a/assets/css/_partial/_single/_admonition.scss +++ b/assets/css/_partial/_single/_admonition.scss @@ -1,39 +1,42 @@ .admonition { position: relative; margin: 1rem 0; - padding: 0 .75rem; - background-color: map-get($admonition-background-color-map, 'note'); - border-left: .25rem solid map-get($admonition-color-map, 'note'); + padding: 0 0.75rem; + background-color: map-get($admonition-background-color-map, "note"); + border-left: 0.25rem solid map-get($admonition-color-map, "note"); overflow: auto; .admonition-title { font-weight: bold; margin: 0 -0.75rem; - padding: .25rem 1.8rem; - border-bottom: 1px solid map-get($admonition-background-color-map, 'note'); - background-color: opacify(map-get($admonition-background-color-map, 'note'), 0.15); + padding: 0.25rem 1.8rem; + border-bottom: 1px solid map-get($admonition-background-color-map, "note"); + background-color: opacify( + map-get($admonition-background-color-map, "note"), + 0.15 + ); } &.open .admonition-title { - background-color: map-get($admonition-background-color-map, 'note'); + background-color: map-get($admonition-background-color-map, "note"); } .admonition-content { - padding: .5rem 0; + padding: 0.5rem 0; } span.icon > svg { font-size: 0.85rem; - color: map-get($admonition-color-map, 'note'); + color: map-get($admonition-color-map, "note"); position: absolute; - top: .6rem; - left: .4rem; + top: 0.6rem; + left: 0.4rem; } span.details-icon > svg { position: absolute; - top: .6rem; - right: .3rem; + top: 0.6rem; + right: 0.3rem; } @each $type, $color in $admonition-color-map { @@ -62,6 +65,6 @@ } &:last-child { - margin-bottom: .75rem; + margin-bottom: 0.75rem; } } diff --git a/assets/css/_partial/_single/_code.scss b/assets/css/_partial/_single/_code.scss index e9ba759c9..d82d43d4f 100644 --- a/assets/css/_partial/_single/_code.scss +++ b/assets/css/_partial/_single/_code.scss @@ -30,11 +30,10 @@ pre, font-size: $code-font-size; .table-wrapper { - - >table, - >table thead, - >table tr, - >table td { + > table, + > table thead, + > table tr, + > table td { margin: 0; padding: 0; border: none !important; @@ -43,7 +42,6 @@ pre, } .gist { - .gist-file, .gist-data, .gist-meta { @@ -51,13 +49,11 @@ pre, } .gist-meta { - padding: .4rem .8rem; + padding: 0.4rem 0.8rem; background-color: $code-background-color-darken-5; @include link(false, false); - } - } .show-line-numbers > pre > code > span::before { diff --git a/assets/css/_partial/_single/_echarts.scss b/assets/css/_partial/_single/_echarts.scss index c5c58725b..12c580624 100644 --- a/assets/css/_partial/_single/_echarts.scss +++ b/assets/css/_partial/_single/_echarts.scss @@ -1,4 +1,4 @@ .echarts { - margin: .5rem 0; + margin: 0.5rem 0; text-align: center; } diff --git a/assets/css/_partial/_single/_footer.scss b/assets/css/_partial/_single/_footer.scss index eef0c44a7..868247fa3 100644 --- a/assets/css/_partial/_single/_footer.scss +++ b/assets/css/_partial/_single/_footer.scss @@ -32,7 +32,7 @@ .post-info-share { display: inline-flex; justify-content: center; - + a * { vertical-align: text-bottom; } @@ -43,13 +43,13 @@ border: none; padding: 0; font: inherit; - outline: inherit; + outline: inherit; * { vertical-align: text-bottom; - } + } :hover { - color: $global-link-hover-color; - } + color: $global-link-hover-color; + } } .weixin { diff --git a/assets/css/_partial/_single/_friend.scss b/assets/css/_partial/_single/_friend.scss index fcaff6683..83a8e6f99 100644 --- a/assets/css/_partial/_single/_friend.scss +++ b/assets/css/_partial/_single/_friend.scss @@ -1,53 +1,53 @@ -.friend-link-div { - height: 92px; - margin-top: 5px; - width: 48%; - display: inline-block; - background: $friend-link-background-color; - vertical-align: top; - -webkit-transition: transform 0.4s ease; - -moz-transition: transform 0.4s ease; - -o-transition: transform 0.4s ease; - transition: transform 0.4s ease; - &:hover { - @include transform(scale(1.01)); - } - .friend-link-avatar { - width: 92px; - float: left; - height: 100%; - img { - width: 56px; - height: 56px; - margin: 18px; - border-radius: 50%; - } - } - .friend-link-info { - margin: 18px 18px 18px 92px; - color: $friend-link-color; - &:hover { - color: $friend-link-hover-color; - } - .friend-name-div { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - .friend-name { - font-style: normal; - } - } - .friend-bio { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - color: $global-font-secondary-color; - } - } -} - -@media screen and (max-width: 680px) { - .friend-link-div { - width: 100%; - } -} +.friend-link-div { + height: 92px; + margin-top: 5px; + width: 48%; + display: inline-block; + background: $friend-link-background-color; + vertical-align: top; + -webkit-transition: transform 0.4s ease; + -moz-transition: transform 0.4s ease; + -o-transition: transform 0.4s ease; + transition: transform 0.4s ease; + &:hover { + @include transform(scale(1.01)); + } + .friend-link-avatar { + width: 92px; + float: left; + height: 100%; + img { + width: 56px; + height: 56px; + margin: 18px; + border-radius: 50%; + } + } + .friend-link-info { + margin: 18px 18px 18px 92px; + color: $friend-link-color; + &:hover { + color: $friend-link-hover-color; + } + .friend-name-div { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + .friend-name { + font-style: normal; + } + } + .friend-bio { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + color: $global-font-secondary-color; + } + } +} + +@media screen and (max-width: 680px) { + .friend-link-div { + width: 100%; + } +} diff --git a/assets/css/_partial/_single/_katex.scss b/assets/css/_partial/_single/_katex.scss index 5d91912ca..e0a39b576 100644 --- a/assets/css/_partial/_single/_katex.scss +++ b/assets/css/_partial/_single/_katex.scss @@ -1,12 +1,12 @@ .katex-display { - overflow: auto hidden; + overflow: auto hidden; } .katex-display > .katex { - white-space: normal; + white-space: normal; } .katex-display > .base { - margin: 0.25em 0; + margin: 0.25em 0; } .katex-display { - margin: 0.5em 0; + margin: 0.5em 0; } diff --git a/assets/css/_partial/_single/_mapbox.scss b/assets/css/_partial/_single/_mapbox.scss index 4ed985608..6762e7e77 100644 --- a/assets/css/_partial/_single/_mapbox.scss +++ b/assets/css/_partial/_single/_mapbox.scss @@ -1,4 +1,4 @@ .mapbox { - margin: .5rem 0; - padding: .5rem 0; + margin: 0.5rem 0; + padding: 0.5rem 0; } diff --git a/assets/css/_partial/_single/_mermaid.scss b/assets/css/_partial/_single/_mermaid.scss index 5ea063bf7..57b13f4ea 100644 --- a/assets/css/_partial/_single/_mermaid.scss +++ b/assets/css/_partial/_single/_mermaid.scss @@ -1,8 +1,8 @@ pre.mermaid { - background: unset; - > svg { - max-width: 100%; - display: block; - margin: auto; - } -} \ No newline at end of file + background: unset; + > svg { + max-width: 100%; + display: block; + margin: auto; + } +} diff --git a/assets/css/_partial/_single/_music.scss b/assets/css/_partial/_single/_music.scss index 2a2054949..a4cf9c275 100644 --- a/assets/css/_partial/_single/_music.scss +++ b/assets/css/_partial/_single/_music.scss @@ -1,3 +1,3 @@ meting-js { - margin: .5rem 0; + margin: 0.5rem 0; } diff --git a/assets/css/_partial/_single/_related.scss b/assets/css/_partial/_single/_related.scss index d6c719f69..fb5eb62ea 100644 --- a/assets/css/_partial/_single/_related.scss +++ b/assets/css/_partial/_single/_related.scss @@ -1,53 +1,52 @@ .related-container { - - display: flex; - flex-wrap: nowrap; - overflow-x: scroll; - width: 100%; - height: 280px; - - .related-item-container { - flex-basis: 350px; - flex-grow: 1; - flex-shrink: 1; - height: 270px; - min-width: 300px; - margin-right: 20px; - background: $related-background-color; - position: relative; - } - - .related-image { - @include transition(transform 0.4s ease); - - img { - width: 100%; - height: 200px; - object-fit: cover; - } - - &:hover { - @include transform(scale(1.01)); - } + display: flex; + flex-wrap: nowrap; + overflow-x: scroll; + width: 100%; + height: 280px; + + .related-item-container { + flex-basis: 350px; + flex-grow: 1; + flex-shrink: 1; + height: 270px; + min-width: 300px; + margin-right: 20px; + background: $related-background-color; + position: relative; + } + + .related-image { + @include transition(transform 0.4s ease); + + img { + width: 100%; + height: 200px; + object-fit: cover; } - .related-title { - position: absolute; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - top: 210px; - width: 95%; - margin: 10px; - font-size: 1.25rem; - line-height: 140%; + &:hover { + @include transform(scale(1.01)); } - - .related-title a { - color: $related-color; - - &:hover { - color: $related-hover-color; - } + } + + .related-title { + position: absolute; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + top: 210px; + width: 95%; + margin: 10px; + font-size: 1.25rem; + line-height: 140%; + } + + .related-title a { + color: $related-color; + + &:hover { + color: $related-hover-color; } -} \ No newline at end of file + } +} diff --git a/assets/css/_partial/_single/_series.scss b/assets/css/_partial/_single/_series.scss index 2d696afb7..76697fbbe 100644 --- a/assets/css/_partial/_single/_series.scss +++ b/assets/css/_partial/_single/_series.scss @@ -1,60 +1,58 @@ .series-nav { - margin: .8rem 0; - &[kept=true] { - display: block; - } - .series-title { - font-size: $toc-title-font-size; - font-weight: bold; - display: flex; - justify-content: space-between; - line-height: 2em; - padding: 0 .75rem; - background: $code-background-color-darken-6; + margin: 0.8rem 0; + &[kept="true"] { + display: block; + } + .series-title { + font-size: $toc-title-font-size; + font-weight: bold; + display: flex; + justify-content: space-between; + line-height: 2em; + padding: 0 0.75rem; + background: $code-background-color-darken-6; + } + + .series-content { + font-size: $toc-content-font-size; + background-color: $code-background-color; + > nav > ul { + margin: 0; + padding: 0.4rem 1rem 0.4rem 1.8rem; } - - .series-content { - font-size: $toc-content-font-size; - background-color: $code-background-color; - - > nav > ul { - margin: 0; - padding: .4rem 1rem .4rem 1.8rem; + + ul { + text-indent: -0.85rem; + padding-left: 0.8rem; + list-style: none; + + a:first-child::before { + content: "|"; + font-weight: bolder; + margin-right: 0.5rem; + color: $single-link-color; } - - ul { - text-indent: -0.85rem; - padding-left: .8rem; - list-style: none; - - a:first-child::before { + span.active { + &:first-child::before { content: "|"; - font-weight: bolder; - margin-right: .5rem; - color: $single-link-color; + margin-right: 0.5rem; } - span.active { - &:first-child::before { - content: "|"; - margin-right: .5rem; - } - font-weight: bolder; - color: $single-link-color; - - &::before { - color: $single-link-hover-color; - } - } - ul { - padding-left: 1.5rem; + font-weight: bolder; + color: $single-link-color; + + &::before { + color: $single-link-hover-color; } } - } - &.open { - .toc-title { - background: $code-header-color; - } + ul { + padding-left: 1.5rem; } + } + } + &.open { + .toc-title { + background: $code-header-color; + } + } } - \ No newline at end of file diff --git a/assets/css/_partial/_single/_showcase.scss b/assets/css/_partial/_single/_showcase.scss index 22fd95c35..fcf1979c7 100644 --- a/assets/css/_partial/_single/_showcase.scss +++ b/assets/css/_partial/_single/_showcase.scss @@ -1,93 +1,92 @@ - .showcase-box { - width: 48%; - height: 370px; - margin: 1% 0% 0% 0%; - display: inline-block !important; - background: $showcase-background-color; - position: relative; + width: 48%; + height: 370px; + margin: 1% 0% 0% 0%; + display: inline-block !important; + background: $showcase-background-color; + position: relative; } .column-1 { - width: 100%; - margin: 1% 0% 0% 0%; + width: 100%; + margin: 1% 0% 0% 0%; } .column-2 { - width: 48%; + width: 48%; } .column-3 { - width: 32%; + width: 32%; } .showcase-image { - @include transition(transform 0.4s ease); + @include transition(transform 0.4s ease); - img { - width: 96%; - margin: 2% 2% 0% 2%; - height: 200px; - max-width: none; - object-fit: cover; - } + img { + width: 96%; + margin: 2% 2% 0% 2%; + height: 200px; + max-width: none; + object-fit: cover; + } - &:hover { - @include transform(scale(1.01)); - } + &:hover { + @include transform(scale(1.01)); + } } .showcase-title { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - position: absolute; - top: 210px; - width: 96%; - margin: 3% 3% 3% 2%; - font-size: 1.25rem; - line-height: 140%; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + position: absolute; + top: 210px; + width: 96%; + margin: 3% 3% 3% 2%; + font-size: 1.25rem; + line-height: 140%; } .showcase-title a { - color: $showcase-color; + color: $showcase-color; - &:hover { - color: $showcase-hover-color; - } + &:hover { + color: $showcase-hover-color; + } } .showcase-summary { - position: absolute; - text-overflow: ellipsis; - overflow: hidden; - margin: 2%; - top: 250px; - height: 70px; - width: 96%; + position: absolute; + text-overflow: ellipsis; + overflow: hidden; + margin: 2%; + top: 250px; + height: 70px; + width: 96%; } .showcase-link { - position: absolute; - bottom: 2%; - left: 2%; + position: absolute; + bottom: 2%; + left: 2%; } .showcase-link-extra { - position: absolute; - bottom: 2%; - right: 2%; + position: absolute; + bottom: 2%; + right: 2%; } @media screen and (max-width: 680px) { - .showcase-box { - width: 100% !important; - margin: 1% 0% 0% 0%; - } + .showcase-box { + width: 100% !important; + margin: 1% 0% 0% 0%; + } } @media screen and (max-width: 1000px) { - .column-3 { - width: 48%; - } -} \ No newline at end of file + .column-3 { + width: 48%; + } +} diff --git a/assets/css/_partial/_single/_sponsor.scss b/assets/css/_partial/_single/_sponsor.scss index ac7908e1a..74da036b5 100644 --- a/assets/css/_partial/_single/_sponsor.scss +++ b/assets/css/_partial/_single/_sponsor.scss @@ -1,55 +1,55 @@ .sponsor { - text-align: center; - padding-top: 50px; - .sponsor-avatar { - img { - display: inline-block; - width: 6rem; - height: 6rem; - margin: 10px; - @include border-radius(100%); - @include box-shadow(0 0 0 .3618em rgba(0, 0, 0, .05)); - } + text-align: center; + padding-top: 50px; + .sponsor-avatar { + img { + display: inline-block; + width: 6rem; + height: 6rem; + margin: 10px; + @include border-radius(100%); + @include box-shadow(0 0 0 0.3618em rgba(0, 0, 0, 0.05)); } - .sponsor-custom { - margin: 30px auto; - display: block; + } + .sponsor-custom { + margin: 30px auto; + display: block; + } + .sponsor-bio { + width: 25%; + margin: 10px auto; + } + .sponsor-button { + border-width: 0px; + border-style: solid; + padding: 5px 10px; + margin: 15px auto; + display: inline-block; + background-color: $sponsor-button-background-color; + -webkit-transition: transform 0.4s ease; + -moz-transition: transform 0.4s ease; + -o-transition: transform 0.4s ease; + transition: transform 0.4s ease; + &:hover { + background-color: $sponsor-button-hover-background-color; + @include transform(scale(1.05)); } - .sponsor-bio { - width: 25%; - margin: 10px auto; - } - .sponsor-button { - border-width: 0px; - border-style: solid; - padding: 5px 10px; - margin: 15px auto; - display: inline-block; - background-color: $sponsor-button-background-color; - -webkit-transition: transform 0.4s ease; - -moz-transition: transform 0.4s ease; - -o-transition: transform 0.4s ease; - transition: transform 0.4s ease; - &:hover { - background-color: $sponsor-button-hover-background-color; - @include transform(scale(1.05)); - } - span { - vertical-align: top; - } + span { + vertical-align: top; } + } } @media only screen and (max-width: 1000px) { - .sponsor { - .sponsor-bio { - width: 50%; - } + .sponsor { + .sponsor-bio { + width: 50%; } + } } @media only screen and (max-width: 680px) { - .sponsor { - .sponsor-bio { - width: 75%; - } + .sponsor { + .sponsor-bio { + width: 75%; } + } } diff --git a/assets/css/_partial/_single/_toc.scss b/assets/css/_partial/_single/_toc.scss index 69e747b9b..9add36487 100644 --- a/assets/css/_partial/_single/_toc.scss +++ b/assets/css/_partial/_single/_toc.scss @@ -10,13 +10,13 @@ ul { text-indent: -0.85rem; - padding-left: .8rem; + padding-left: 0.8rem; list-style: none; a:first-child::before { content: "|"; font-weight: bolder; - margin-right: .5rem; + margin-right: 0.5rem; color: $single-link-color; } @@ -32,14 +32,13 @@ rt { color: $global-font-secondary-color; } - } } #toc-auto { display: block; position: absolute; - padding: 0 .8rem; + padding: 0 0.8rem; border-left: 4px solid $global-border-color; @include overflow-wrap(break-word); box-sizing: border-box; @@ -50,7 +49,7 @@ @include blur; .toc-title { - margin: .8rem 0; + margin: 0.8rem 0; } .toc-content { @@ -58,8 +57,8 @@ display: block; } - >nav>ul { - margin: .625rem 0; + > nav > ul { + margin: 0.625rem 0; } ul { @@ -67,7 +66,7 @@ display: none; } - .has-active>ul { + .has-active > ul { display: block; } } @@ -85,9 +84,9 @@ #toc-static { display: none; - margin: .8rem 0; + margin: 0.8rem 0; - &[kept=true] { + &[kept="true"] { display: block; } @@ -95,16 +94,16 @@ display: flex; justify-content: space-between; line-height: 2em; - padding: 0 .75rem; + padding: 0 0.75rem; background: $code-background-color-darken-6; } .toc-content { background-color: $code-background-color; - >nav>ul { + > nav > ul { margin: 0; - padding: .4rem 1rem .4rem 1.8rem; + padding: 0.4rem 1rem 0.4rem 1.8rem; } } @@ -113,4 +112,4 @@ background: $code-header-color; } } -} \ No newline at end of file +} diff --git a/assets/css/_variables.scss b/assets/css/_variables.scss index d265f04d4..69227c6d8 100644 --- a/assets/css/_variables.scss +++ b/assets/css/_variables.scss @@ -4,7 +4,23 @@ // ========== Global ========== // // Font and Line Height -$global-font-family: system-ui, -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei UI, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif !default; +$global-font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + PingFang SC, + Microsoft YaHei UI, + Segoe UI, + Roboto, + Oxygen, + Ubuntu, + Cantarell, + Fira Sans, + Droid Sans, + Helvetica Neue, + Helvetica, + Arial, + sans-serif !default; $global-font-size: 16px; $global-font-weight: 400; $global-line-height: 1.5rem; @@ -96,105 +112,112 @@ $code-background-color: var(--code-background-color) !default; $code-header-color: var(--code-header-color) !default; $code-background-color-darken-5: var(--code-background-color-darken-5) !default; $code-background-color-darken-6: var(--code-background-color-darken-6) !default; -$code-background-color-code-header: var(--code-background-color-code-header) !default; +$code-background-color-code-header: var( + --code-background-color-code-header +) !default; $code-background-color-code-hl: var(--code-background-color-code-hl) !default; $code-info-color: var(--code-info-color) !default; // Font size of the code -$code-font-size: .875rem !default; +$code-font-size: 0.875rem !default; // Font family of the code -$code-font-family: Source Code Pro, Menlo, Consolas, Monaco, monospace, $global-font-family !default; +$code-font-family: + Source Code Pro, + Menlo, + Consolas, + Monaco, + monospace, + $global-font-family !default; // Code type map $code-type-map: ( // Custom code type - language-bash: 'Bash', - language-c: 'C', - language-cs: 'C#', - language-cpp: 'C++', - language-clojure: 'Clojure', - language-coffeescript: 'CoffeeScript', - language-css: 'CSS', - language-dart: 'Dart', - language-diff: 'Diff', - language-erlang: 'Erlang', - language-go: 'Go', - language-go-html-template: 'Go HTML Template', - language-groovy: 'Groovy', - language-haskell: 'Haskell', - language-html: 'HTML', - language-http: 'HTTP', - language-xml: 'XML', - language-java: 'Java', - language-js: 'JavaScript', - language-javascript: 'JavaScript', - language-json: 'JSON', - language-kotlin: 'Kotlin', - language-latex: 'LaTeX', - language-less: 'Less', - language-lisp: 'Lisp', - language-lua: 'Lua', - language-makefile: 'Makefile', - language-markdown: 'Markdown', - language-matlab: 'Matlab', - language-objectivec: 'Objective-C', - language-php: 'PHP', - language-perl: 'Perl', - language-python: 'Python', - language-r: 'R', - language-ruby: 'Ruby', - language-rust: 'Rust', - language-scala: 'Scala', - language-scss: 'Scss', - language-shell: 'Shell', - language-sql: 'SQL', - language-swift: 'Swift', - language-tex: 'TeX', - language-toml: 'TOML', - language-ts: 'TypeScript', - language-typescript: 'TypeScript', - language-vue: 'Vue', - language-yml: 'YAML', - language-yaml: 'YAML', - ) !default; - + language-bash: "Bash", + language-c: "C", + language-cs: "C#", + language-cpp: "C++", + language-clojure: "Clojure", + language-coffeescript: "CoffeeScript", + language-css: "CSS", + language-dart: "Dart", + language-diff: "Diff", + language-erlang: "Erlang", + language-go: "Go", + language-go-html-template: "Go HTML Template", + language-groovy: "Groovy", + language-haskell: "Haskell", + language-html: "HTML", + language-http: "HTTP", + language-xml: "XML", + language-java: "Java", + language-js: "JavaScript", + language-javascript: "JavaScript", + language-json: "JSON", + language-kotlin: "Kotlin", + language-latex: "LaTeX", + language-less: "Less", + language-lisp: "Lisp", + language-lua: "Lua", + language-makefile: "Makefile", + language-markdown: "Markdown", + language-matlab: "Matlab", + language-objectivec: "Objective-C", + language-php: "PHP", + language-perl: "Perl", + language-python: "Python", + language-r: "R", + language-ruby: "Ruby", + language-rust: "Rust", + language-scala: "Scala", + language-scss: "Scss", + language-shell: "Shell", + language-sql: "SQL", + language-swift: "Swift", + language-tex: "TeX", + language-toml: "TOML", + language-ts: "TypeScript", + language-typescript: "TypeScript", + language-vue: "Vue", + language-yml: "YAML", + language-yaml: "YAML" +) !default; // ========== Code ========== // // ========== Admonition ========== // // Color map of the admonition $admonition-color-map: ( - 'note': #448aff, - 'abstract': #00b0ff, - 'info': #00b8d4, - 'tip': #00bfa5, - 'success': #00c853, - 'question': #64dd17, - 'warning': #ff9100, - 'failure': #ff5252, - 'danger': #ff1744, - 'bug': #f50057, - 'example': #651fff, - 'quote': #9e9e9e, - ) !default; + "note": #448aff, + "abstract": #00b0ff, + "info": #00b8d4, + "tip": #00bfa5, + "success": #00c853, + "question": #64dd17, + "warning": #ff9100, + "failure": #ff5252, + "danger": #ff1744, + "bug": #f50057, + "example": #651fff, + "quote": #9e9e9e, +) !default; // Color map of the admonition background $admonition-background-color-map: ( - 'note': rgba(68, 138, 255, 0.1), - 'abstract': rgba(0, 176, 255, 0.1), - 'info': rgba(0, 184, 212, 0.1), - 'tip': rgba(0, 191, 165, 0.1), - 'success': rgba(0, 200, 83, 0.1), - 'question': rgba(100, 221, 23, 0.1), - 'warning': rgba(255, 145, 0, 0.1), - 'failure': rgba(255, 82, 82, 0.1), - 'danger': rgba(255, 23, 68, 0.1), - 'bug': rgba(245, 0, 87, 0.1), - 'example': rgba(101, 31, 255, 0.1), - 'quote': rgba(159, 159, 159, 0.1), - ) !default; + "note": rgba(68, 138, 255, 0.1), + "abstract": rgba(0, 176, 255, 0.1), + "info": rgba(0, 184, 212, 0.1), + "tip": rgba(0, 191, 165, 0.1), + "success": rgba(0, 200, 83, 0.1), + "question": rgba(100, 221, 23, 0.1), + "warning": rgba(255, 145, 0, 0.1), + "failure": rgba(255, 82, 82, 0.1), + "danger": rgba(255, 23, 68, 0.1), + "bug": rgba(245, 0, 87, 0.1), + "example": rgba(101, 31, 255, 0.1), + "quote": rgba(159, 159, 159, 0.1), +) !default; // ========== Friend Link ========== // // Color of friend link background $friend-link-background-color: var(--friend-link-background-color) !default; @@ -206,13 +229,16 @@ $friend-link-color: var(--friend-link-color) !default; $friend-link-hover-color: var(--friend-link-hover-color) !default; // ========== Friend Link ========== // - // ========== Sponsor Button ========== // // Sponsor button background color -$sponsor-button-background-color: var(--sponsor-button-background-color) !default; +$sponsor-button-background-color: var( + --sponsor-button-background-color +) !default; // Sponsor button background color while in the :hover state -$sponsor-button-hover-background-color: var(--sponsor-button-hover-background-color) !default; +$sponsor-button-hover-background-color: var( + --sponsor-button-hover-background-color +) !default; // ========== Sponsor Button ========== // // ========== Cookie Consent ========== // @@ -229,4 +255,4 @@ $related-hover-color: var(--related-hover-color) !default; $showcase-background-color: var(--showcase-background-color) !default; $showcase-color: var(--showcase-color) !default; $showcase-hover-color: var(--showcase-hover-color) !default; -// ========== showcase ========== // \ No newline at end of file +// ========== showcase ========== // diff --git a/assets/css/tailwind.css b/assets/css/tailwind.css index 66f2d3b7e..27fb80b5f 100644 --- a/assets/css/tailwind.css +++ b/assets/css/tailwind.css @@ -25,7 +25,7 @@ .tw-align-image { vertical-align: -0.125em; } - + :root { /* ========== Global ========== */ /* Color of the background */ @@ -79,7 +79,7 @@ /* ========== Pagination ========== */ /* Color of the link in pagination */ - --pagination-link-color: #2d809a; + --pagination-link-color: #2d809a; /* Color of the hover link in pagination */ --pagination-link-hover-color: #000; /* ========== Pagination ========== */ @@ -142,7 +142,7 @@ --borderColor-default: #f0f0f0; --selection-bgColor: #35a6f740; --button-default-bgColor-rest: #f0f0f0; - --button-default-bgColor-hover: #f0f0f0; + --button-default-bgColor-hover: #f0f0f0; /* ========== primitives ========== */ } /* Theme dark */ @@ -160,7 +160,7 @@ --borderColor-default: #30363d; --selection-bgColor: #1f6febb3; --button-default-bgColor-rest: #21262d; - --button-default-bgColor-hover: #292e36; + --button-default-bgColor-hover: #292e36; /* ========== primitives ========== */ --global-background-color: var(--bgColor-default); @@ -198,7 +198,9 @@ --friend-link-hover-color: var(--fgColor-link-hover); --sponsor-button-background-color: var(--button-default-bgColor-rest); - --sponsor-button-hover-background-color: var(--button-default-bgColor-hover); + --sponsor-button-hover-background-color: var( + --button-default-bgColor-hover + ); --cookie-background-color: white; @@ -207,7 +209,9 @@ --code-header-color: var(--bgColor-secondary); --code-background-color-darken-5: #1c2025; /* TODO */ --code-background-color-darken-6: #1a1d23; /* TODO */ - --code-background-color-code-header: var(--code-background-color-darken-6); /* TODO */ + --code-background-color-code-header: var( + --code-background-color-darken-6 + ); /* TODO */ --code-background-color-code-hl: #1c2025; /* TODO */ --code-info-color: #b1b0b0; /* TODO */ diff --git a/assets/css/themes/_themes.scss b/assets/css/themes/_themes.scss index cc7887022..94801f98c 100644 --- a/assets/css/themes/_themes.scss +++ b/assets/css/themes/_themes.scss @@ -5,4 +5,4 @@ // Syntax for gist dark @import "syntax-gist-dark"; -// Themes is in assets/css/tailwind.css \ No newline at end of file +// Themes is in assets/css/tailwind.css diff --git a/assets/css/themes/code-map.scss b/assets/css/themes/code-map.scss index 03a69cc8f..f3644ec9a 100644 --- a/assets/css/themes/code-map.scss +++ b/assets/css/themes/code-map.scss @@ -3,298 +3,152 @@ // This three variables was for code highlight assets/css/_partial/_single/_code.scss before rewrite // Color map of the code highlight $code-highlight-color-map: ( - /* Parentheses */ - 'p': #a9a9b3, - /* Keyword */ - 'k': #b501a9, - /* KeywordConstant */ - 'kc': #b501a9, - /* KeywordDeclaration */ - 'kd': #b501a9, - /* KeywordNamespace */ - 'kn': #b501a9, - /* KeywordPseudo */ - 'kp': #b501a9, - /* KeywordReserved */ - 'kr': #b501a9, - /* KeywordType */ - 'kt': #b501a9, - /* Name */ - 'n': #333333, - /* NameAttribute */ - 'na': #2b77fa, - /* NameBuiltin */ - 'nb': #f74840, - /* NameBuiltinPseudo */ - 'bp': #f74840, - /* NameClass */ - 'nc': #cb8100, - /* NameConstant */ - 'no': #2b77fa, - /* NameDecorator */ - 'nd': #0086c1, - /* NameEntity */ - 'ni': #2b77fa, - /* NameException */ - 'ne': #2b77fa, - /* NameFunction */ - 'nf': #2b77fa, - /* NameFunctionMagic */ - 'fm': #1ccad6, - /* NameLabel */ - 'nl': #2b77fa, - /* NameNamespace */ - 'nn': #2b77fa, - /* NameOther */ - 'nx': #333333, - /* NameProperty */ - 'py': #2b77fa, - /* NameTag */ - 'nt': #2b77fa, - /* NameVariable */ - 'nv': #2b77fa, - /* NameVariableClass */ - 'vc': #2b77fa, - /* NameVariableGlobal */ - 'vg': #2b77fa, - /* NameVariableInstance */ - 'vi': #2b77fa, - /* NameVariableMagic */ - 'vm': #2b77fa, - /* Literal */ - 'l': #2aa198, - /* LiteralDate */ - 'ld': #2aa198, - /* LiteralString */ - 's': #24a443, - /* LiteralStringAffix */ - 'sa': #24a443, - /* LiteralStringBacktick */ - 'sb': #24a443, - /* LiteralStringChar */ - 'sc': #24a443, - /* LiteralStringDelimiter */ - 'dl': #24a443, - /* LiteralStringDoc */ - 'sd': #24a443, - /* LiteralStringDouble */ - 's2': #24a443, - /* LiteralStringEscape */ - 'se': #24a443, - /* LiteralStringHeredoc */ - 'sh': #24a443, - /* LiteralStringInterpol */ - 'si': #24a443, - /* LiteralStringOther */ - 'sx': #24a443, - /* LiteralStringRegex */ - 'sr': #24a443, - /* LiteralStringSingle */ - 's1': #24a443, - /* LiteralStringSymbol */ - 'ss': #24a443, - /* LiteralNumber */ - 'm': #e2893c, - /* LiteralNumberBin */ - 'mb': #e2893c, - /* LiteralNumberFloat */ - 'mf': #e2893c, - /* LiteralNumberHex */ - 'mh': #e2893c, - /* LiteralNumberInteger */ - 'mi': #e2893c, - /* LiteralNumberIntegerLong */ - 'il': #e2893c, - /* LiteralNumberOct */ - 'mo': #e2893c, - /* Operator */ - 'o': #f19b04, - /* OperatorWord */ - 'ow': #b501a9, - /* Comment */ - 'c': #a0a1a8, - /* CommentHashbang */ - 'ch': #a0a1a8, - /* CommentMultiline */ - 'cm': #a0a1a8, - /* CommentSingle */ - 'c1': #a0a1a8, - /* CommentSpecial */ - 'cs': #a0a1a8, - /* CommentPreproc */ - 'cp': #a0a1a8, - /* CommentPreprocFile */ - 'cpf': #a0a1a8, - /* Generic */ - 'g': #e72d40, - /* GenericDeleted */ - 'gd': #e72d40, - /* GenericEmph */ - 'ge': #e72d40, - /* GenericError */ - 'gr': #e72d40, - /* GenericHeading */ - 'gh': #e72d40, - /* GenericInserted */ - 'gi': #e72d40, - /* GenericOutput */ - 'go': #e72d40, - /* GenericPrompt */ - 'gp': #e72d40, - /* GenericStrong */ - 'gs': #e72d40, - /* GenericSubheading */ - 'gu': #e72d40, - /* GenericTraceback */ - 'gt': #e72d40, - /* TextWhitespace */ - 'w': #bbbbbb, - ) !default; + /* Parentheses */ "p": #a9a9b3, + /* Keyword */ "k": #b501a9, + /* KeywordConstant */ "kc": #b501a9, + /* KeywordDeclaration */ "kd": #b501a9, + /* KeywordNamespace */ "kn": #b501a9, + /* KeywordPseudo */ "kp": #b501a9, + /* KeywordReserved */ "kr": #b501a9, + /* KeywordType */ "kt": #b501a9, + /* Name */ "n": #333333, + /* NameAttribute */ "na": #2b77fa, + /* NameBuiltin */ "nb": #f74840, + /* NameBuiltinPseudo */ "bp": #f74840, + /* NameClass */ "nc": #cb8100, + /* NameConstant */ "no": #2b77fa, + /* NameDecorator */ "nd": #0086c1, + /* NameEntity */ "ni": #2b77fa, + /* NameException */ "ne": #2b77fa, + /* NameFunction */ "nf": #2b77fa, + /* NameFunctionMagic */ "fm": #1ccad6, + /* NameLabel */ "nl": #2b77fa, + /* NameNamespace */ "nn": #2b77fa, + /* NameOther */ "nx": #333333, + /* NameProperty */ "py": #2b77fa, + /* NameTag */ "nt": #2b77fa, + /* NameVariable */ "nv": #2b77fa, + /* NameVariableClass */ "vc": #2b77fa, + /* NameVariableGlobal */ "vg": #2b77fa, + /* NameVariableInstance */ "vi": #2b77fa, + /* NameVariableMagic */ "vm": #2b77fa, + /* Literal */ "l": #2aa198, + /* LiteralDate */ "ld": #2aa198, + /* LiteralString */ "s": #24a443, + /* LiteralStringAffix */ "sa": #24a443, + /* LiteralStringBacktick */ "sb": #24a443, + /* LiteralStringChar */ "sc": #24a443, + /* LiteralStringDelimiter */ "dl": #24a443, + /* LiteralStringDoc */ "sd": #24a443, + /* LiteralStringDouble */ "s2": #24a443, + /* LiteralStringEscape */ "se": #24a443, + /* LiteralStringHeredoc */ "sh": #24a443, + /* LiteralStringInterpol */ "si": #24a443, + /* LiteralStringOther */ "sx": #24a443, + /* LiteralStringRegex */ "sr": #24a443, + /* LiteralStringSingle */ "s1": #24a443, + /* LiteralStringSymbol */ "ss": #24a443, + /* LiteralNumber */ "m": #e2893c, + /* LiteralNumberBin */ "mb": #e2893c, + /* LiteralNumberFloat */ "mf": #e2893c, + /* LiteralNumberHex */ "mh": #e2893c, + /* LiteralNumberInteger */ "mi": #e2893c, + /* LiteralNumberIntegerLong */ "il": #e2893c, + /* LiteralNumberOct */ "mo": #e2893c, + /* Operator */ "o": #f19b04, + /* OperatorWord */ "ow": #b501a9, + /* Comment */ "c": #a0a1a8, + /* CommentHashbang */ "ch": #a0a1a8, + /* CommentMultiline */ "cm": #a0a1a8, + /* CommentSingle */ "c1": #a0a1a8, + /* CommentSpecial */ "cs": #a0a1a8, + /* CommentPreproc */ "cp": #a0a1a8, + /* CommentPreprocFile */ "cpf": #a0a1a8, + /* Generic */ "g": #e72d40, + /* GenericDeleted */ "gd": #e72d40, + /* GenericEmph */ "ge": #e72d40, + /* GenericError */ "gr": #e72d40, + /* GenericHeading */ "gh": #e72d40, + /* GenericInserted */ "gi": #e72d40, + /* GenericOutput */ "go": #e72d40, + /* GenericPrompt */ "gp": #e72d40, + /* GenericStrong */ "gs": #e72d40, + /* GenericSubheading */ "gu": #e72d40, + /* GenericTraceback */ "gt": #e72d40, + /* TextWhitespace */ "w": #bbbbbb +) !default; $code-highlight-color-map-dark: ( - /* Parentheses */ - 'p': #a9a9b3, - /* Keyword */ - 'k': #d371e3, - /* KeywordConstant */ - 'kc': #d371e3, - /* KeywordDeclaration */ - 'kd': #d371e3, - /* KeywordNamespace */ - 'kn': #d371e3, - /* KeywordPseudo */ - 'kp': #d371e3, - /* KeywordReserved */ - 'kr': #d371e3, - /* KeywordType */ - 'kt': #d371e3, - /* Name */ - 'n': #a9b2c0, - /* NameAttribute */ - 'na': #41b0f5, - /* NameBuiltin */ - 'nb': #19b9c4, - /* NameBuiltinPseudo */ - 'bp': #ecbf6f, - /* NameClass */ - 'nc': #ecbf6f, - /* NameConstant */ - 'no': #41b0f5, - /* NameDecorator */ - 'nd': #ecbf6f, - /* NameEntity */ - 'ni': #41b0f5, - /* NameException */ - 'ne': #41b0f5, - /* NameFunction */ - 'nf': #41b0f5, - /* NameFunctionMagic */ - 'fm': #19b9c4, - /* NameLabel */ - 'nl': #41b0f5, - /* NameNamespace */ - 'nn': #41b0f5, - /* NameOther */ - 'nx': #a9a9b3, - /* NameProperty */ - 'py': #41b0f5, - /* NameTag */ - 'nt': #41b0f5, - /* NameVariable */ - 'nv': #41b0f5, - /* NameVariableClass */ - 'vc': #41b0f5, - /* NameVariableGlobal */ - 'vg': #41b0f5, - /* NameVariableInstance */ - 'vi': #41b0f5, - /* NameVariableMagic */ - 'vm': #41b0f5, - /* Literal */ - 'l': #2aa198, - /* LiteralDate */ - 'ld': #2aa198, - /* LiteralString */ - 's': #8cc570, - /* LiteralStringAffix */ - 'sa': #8cc570, - /* LiteralStringBacktick */ - 'sb': #8cc570, - /* LiteralStringChar */ - 'sc': #8cc570, - /* LiteralStringDelimiter */ - 'dl': #8cc570, - /* LiteralStringDoc */ - 'sd': #8cc570, - /* LiteralStringDouble */ - 's2': #8cc570, - /* LiteralStringEscape */ - 'se': #8cc570, - /* LiteralStringHeredoc */ - 'sh': #8cc570, - /* LiteralStringInterpol */ - 'si': #8cc570, - /* LiteralStringOther */ - 'sx': #8cc570, - /* LiteralStringRegex */ - 'sr': #8cc570, - /* LiteralStringSingle */ - 's1': #8cc570, - /* LiteralStringSymbol */ - 'ss': #8cc570, - /* LiteralNumber */ - 'm': #db985c, - /* LiteralNumberBin */ - 'mb': #db985c, - /* LiteralNumberFloat */ - 'mf': #db985c, - /* LiteralNumberHex */ - 'mh': #db985c, - /* LiteralNumberInteger */ - 'mi': #db985c, - /* LiteralNumberIntegerLong */ - 'il': #db985c, - /* LiteralNumberOct */ - 'mo': #db985c, - /* Operator */ - 'o': #ecbf6f, - /* OperatorWord */ - 'ow': #d371e3, - /* Comment */ - 'c': #7e848f, - /* CommentHashbang */ - 'ch': #7e848f, - /* CommentMultiline */ - 'cm': #7e848f, - /* CommentSingle */ - 'c1': #7e848f, - /* CommentSpecial */ - 'cs': #7e848f, - /* CommentPreproc */ - 'cp': #7e848f, - /* CommentPreprocFile */ - 'cpf': #7e848f, - /* Generic */ - 'g': #f16372, - /* GenericDeleted */ - 'gd': #f16372, - /* GenericEmph */ - 'ge': #f16372, - /* GenericError */ - 'gr': #f16372, - /* GenericHeading */ - 'gh': #f16372, - /* GenericInserted */ - 'gi': #f16372, - /* GenericOutput */ - 'go': #f16372, - /* GenericPrompt */ - 'gp': #f16372, - /* GenericStrong */ - 'gs': #f16372, - /* GenericSubheading */ - 'gu': #f16372, - /* GenericTraceback */ - 'gt': #f16372, - /* TextWhitespace */ - 'w': #bbbbbb, - ) !default; + /* Parentheses */ "p": #a9a9b3, + /* Keyword */ "k": #d371e3, + /* KeywordConstant */ "kc": #d371e3, + /* KeywordDeclaration */ "kd": #d371e3, + /* KeywordNamespace */ "kn": #d371e3, + /* KeywordPseudo */ "kp": #d371e3, + /* KeywordReserved */ "kr": #d371e3, + /* KeywordType */ "kt": #d371e3, + /* Name */ "n": #a9b2c0, + /* NameAttribute */ "na": #41b0f5, + /* NameBuiltin */ "nb": #19b9c4, + /* NameBuiltinPseudo */ "bp": #ecbf6f, + /* NameClass */ "nc": #ecbf6f, + /* NameConstant */ "no": #41b0f5, + /* NameDecorator */ "nd": #ecbf6f, + /* NameEntity */ "ni": #41b0f5, + /* NameException */ "ne": #41b0f5, + /* NameFunction */ "nf": #41b0f5, + /* NameFunctionMagic */ "fm": #19b9c4, + /* NameLabel */ "nl": #41b0f5, + /* NameNamespace */ "nn": #41b0f5, + /* NameOther */ "nx": #a9a9b3, + /* NameProperty */ "py": #41b0f5, + /* NameTag */ "nt": #41b0f5, + /* NameVariable */ "nv": #41b0f5, + /* NameVariableClass */ "vc": #41b0f5, + /* NameVariableGlobal */ "vg": #41b0f5, + /* NameVariableInstance */ "vi": #41b0f5, + /* NameVariableMagic */ "vm": #41b0f5, + /* Literal */ "l": #2aa198, + /* LiteralDate */ "ld": #2aa198, + /* LiteralString */ "s": #8cc570, + /* LiteralStringAffix */ "sa": #8cc570, + /* LiteralStringBacktick */ "sb": #8cc570, + /* LiteralStringChar */ "sc": #8cc570, + /* LiteralStringDelimiter */ "dl": #8cc570, + /* LiteralStringDoc */ "sd": #8cc570, + /* LiteralStringDouble */ "s2": #8cc570, + /* LiteralStringEscape */ "se": #8cc570, + /* LiteralStringHeredoc */ "sh": #8cc570, + /* LiteralStringInterpol */ "si": #8cc570, + /* LiteralStringOther */ "sx": #8cc570, + /* LiteralStringRegex */ "sr": #8cc570, + /* LiteralStringSingle */ "s1": #8cc570, + /* LiteralStringSymbol */ "ss": #8cc570, + /* LiteralNumber */ "m": #db985c, + /* LiteralNumberBin */ "mb": #db985c, + /* LiteralNumberFloat */ "mf": #db985c, + /* LiteralNumberHex */ "mh": #db985c, + /* LiteralNumberInteger */ "mi": #db985c, + /* LiteralNumberIntegerLong */ "il": #db985c, + /* LiteralNumberOct */ "mo": #db985c, + /* Operator */ "o": #ecbf6f, + /* OperatorWord */ "ow": #d371e3, + /* Comment */ "c": #7e848f, + /* CommentHashbang */ "ch": #7e848f, + /* CommentMultiline */ "cm": #7e848f, + /* CommentSingle */ "c1": #7e848f, + /* CommentSpecial */ "cs": #7e848f, + /* CommentPreproc */ "cp": #7e848f, + /* CommentPreprocFile */ "cpf": #7e848f, + /* Generic */ "g": #f16372, + /* GenericDeleted */ "gd": #f16372, + /* GenericEmph */ "ge": #f16372, + /* GenericError */ "gr": #f16372, + /* GenericHeading */ "gh": #f16372, + /* GenericInserted */ "gi": #f16372, + /* GenericOutput */ "go": #f16372, + /* GenericPrompt */ "gp": #f16372, + /* GenericStrong */ "gs": #f16372, + /* GenericSubheading */ "gu": #f16372, + /* GenericTraceback */ "gt": #f16372, + /* TextWhitespace */ "w": #bbbbbb +) !default; diff --git a/assets/css/themes/syntax-catppuccin-latte.scss b/assets/css/themes/syntax-catppuccin-latte.scss index f11d6173c..456c13881 100644 --- a/assets/css/themes/syntax-catppuccin-latte.scss +++ b/assets/css/themes/syntax-catppuccin-latte.scss @@ -1,88 +1,370 @@ .light { -/* Background */ .bg { color:#4c4f69;background-color:#eff1f5; } -/* PreWrapper */ .chroma { color:#4c4f69;background-color:#eff1f5; } -/* Other */ .chroma .x { } -/* Error */ .chroma .err { color:#d20f39 } -/* CodeLine */ .chroma .cl { } -/* LineLink */ .chroma .lnlinks { outline:none;text-decoration:none;color:inherit } -/* LineTableTD */ .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; } -/* LineTable */ .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; } -/* LineHighlight */ .chroma .hl { background-color:#bcc0cc } -/* LineNumbersTable */ .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8c8fa1 } -/* LineNumbers */ .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#8c8fa1 } -/* Line */ .chroma .line { display:flex; } -/* Keyword */ .chroma .k { color:#8839ef } -/* KeywordConstant */ .chroma .kc { color:#fe640b } -/* KeywordDeclaration */ .chroma .kd { color:#d20f39 } -/* KeywordNamespace */ .chroma .kn { color:#179299 } -/* KeywordPseudo */ .chroma .kp { color:#8839ef } -/* KeywordReserved */ .chroma .kr { color:#8839ef } -/* KeywordType */ .chroma .kt { color:#d20f39 } -/* Name */ .chroma .n { } -/* NameAttribute */ .chroma .na { color:#1e66f5 } -/* NameBuiltin */ .chroma .nb { color:#04a5e5 } -/* NameBuiltinPseudo */ .chroma .bp { color:#04a5e5 } -/* NameClass */ .chroma .nc { color:#df8e1d } -/* NameConstant */ .chroma .no { color:#df8e1d } -/* NameDecorator */ .chroma .nd { color:#1e66f5;font-weight:bold } -/* NameEntity */ .chroma .ni { color:#179299 } -/* NameException */ .chroma .ne { color:#fe640b } -/* NameFunction */ .chroma .nf { color:#1e66f5 } -/* NameFunctionMagic */ .chroma .fm { color:#1e66f5 } -/* NameLabel */ .chroma .nl { color:#04a5e5 } -/* NameNamespace */ .chroma .nn { color:#fe640b } -/* NameOther */ .chroma .nx { } -/* NameProperty */ .chroma .py { color:#fe640b } -/* NameTag */ .chroma .nt { color:#8839ef } -/* NameVariable */ .chroma .nv { color:#dc8a78 } -/* NameVariableClass */ .chroma .vc { color:#dc8a78 } -/* NameVariableGlobal */ .chroma .vg { color:#dc8a78 } -/* NameVariableInstance */ .chroma .vi { color:#dc8a78 } -/* NameVariableMagic */ .chroma .vm { color:#dc8a78 } -/* Literal */ .chroma .l { } -/* LiteralDate */ .chroma .ld { } -/* LiteralString */ .chroma .s { color:#40a02b } -/* LiteralStringAffix */ .chroma .sa { color:#d20f39 } -/* LiteralStringBacktick */ .chroma .sb { color:#40a02b } -/* LiteralStringChar */ .chroma .sc { color:#40a02b } -/* LiteralStringDelimiter */ .chroma .dl { color:#1e66f5 } -/* LiteralStringDoc */ .chroma .sd { color:#9ca0b0 } -/* LiteralStringDouble */ .chroma .s2 { color:#40a02b } -/* LiteralStringEscape */ .chroma .se { color:#1e66f5 } -/* LiteralStringHeredoc */ .chroma .sh { color:#9ca0b0 } -/* LiteralStringInterpol */ .chroma .si { color:#40a02b } -/* LiteralStringOther */ .chroma .sx { color:#40a02b } -/* LiteralStringRegex */ .chroma .sr { color:#179299 } -/* LiteralStringSingle */ .chroma .s1 { color:#40a02b } -/* LiteralStringSymbol */ .chroma .ss { color:#40a02b } -/* LiteralNumber */ .chroma .m { color:#fe640b } -/* LiteralNumberBin */ .chroma .mb { color:#fe640b } -/* LiteralNumberFloat */ .chroma .mf { color:#fe640b } -/* LiteralNumberHex */ .chroma .mh { color:#fe640b } -/* LiteralNumberInteger */ .chroma .mi { color:#fe640b } -/* LiteralNumberIntegerLong */ .chroma .il { color:#fe640b } -/* LiteralNumberOct */ .chroma .mo { color:#fe640b } -/* Operator */ .chroma .o { color:#04a5e5;font-weight:bold } -/* OperatorWord */ .chroma .ow { color:#04a5e5;font-weight:bold } -/* Punctuation */ .chroma .p { } -/* Comment */ .chroma .c { color:#9ca0b0;font-style:italic } -/* CommentHashbang */ .chroma .ch { color:#9ca0b0;font-style:italic } -/* CommentMultiline */ .chroma .cm { color:#9ca0b0;font-style:italic } -/* CommentSingle */ .chroma .c1 { color:#9ca0b0;font-style:italic } -/* CommentSpecial */ .chroma .cs { color:#9ca0b0;font-style:italic } -/* CommentPreproc */ .chroma .cp { color:#9ca0b0;font-style:italic } -/* CommentPreprocFile */ .chroma .cpf { color:#9ca0b0;font-weight:bold;font-style:italic } -/* Generic */ .chroma .g { } -/* GenericDeleted */ .chroma .gd { color:#d20f39;background-color:#ccd0da } -/* GenericEmph */ .chroma .ge { font-style:italic } -/* GenericError */ .chroma .gr { color:#d20f39 } -/* GenericHeading */ .chroma .gh { color:#fe640b;font-weight:bold } -/* GenericInserted */ .chroma .gi { color:#40a02b;background-color:#ccd0da } -/* GenericOutput */ .chroma .go { } -/* GenericPrompt */ .chroma .gp { } -/* GenericStrong */ .chroma .gs { font-weight:bold } -/* GenericSubheading */ .chroma .gu { color:#fe640b;font-weight:bold } -/* GenericTraceback */ .chroma .gt { color:#d20f39 } -/* GenericUnderline */ .chroma .gl { text-decoration:underline } -/* TextWhitespace */ .chroma .w { } -} \ No newline at end of file + /* Background */ + .bg { + color: #4c4f69; + background-color: #eff1f5; + } + /* PreWrapper */ + .chroma { + color: #4c4f69; + background-color: #eff1f5; + } + /* Other */ + .chroma .x { + } + /* Error */ + .chroma .err { + color: #d20f39; + } + /* CodeLine */ + .chroma .cl { + } + /* LineLink */ + .chroma .lnlinks { + outline: none; + text-decoration: none; + color: inherit; + } + /* LineTableTD */ + .chroma .lntd { + vertical-align: top; + padding: 0; + margin: 0; + border: 0; + } + /* LineTable */ + .chroma .lntable { + border-spacing: 0; + padding: 0; + margin: 0; + border: 0; + } + /* LineHighlight */ + .chroma .hl { + background-color: #bcc0cc; + } + /* LineNumbersTable */ + .chroma .lnt { + white-space: pre; + -webkit-user-select: none; + user-select: none; + margin-right: 0.4em; + padding: 0 0.4em 0 0.4em; + color: #8c8fa1; + } + /* LineNumbers */ + .chroma .ln { + white-space: pre; + -webkit-user-select: none; + user-select: none; + margin-right: 0.4em; + padding: 0 0.4em 0 0.4em; + color: #8c8fa1; + } + /* Line */ + .chroma .line { + display: flex; + } + /* Keyword */ + .chroma .k { + color: #8839ef; + } + /* KeywordConstant */ + .chroma .kc { + color: #fe640b; + } + /* KeywordDeclaration */ + .chroma .kd { + color: #d20f39; + } + /* KeywordNamespace */ + .chroma .kn { + color: #179299; + } + /* KeywordPseudo */ + .chroma .kp { + color: #8839ef; + } + /* KeywordReserved */ + .chroma .kr { + color: #8839ef; + } + /* KeywordType */ + .chroma .kt { + color: #d20f39; + } + /* Name */ + .chroma .n { + } + /* NameAttribute */ + .chroma .na { + color: #1e66f5; + } + /* NameBuiltin */ + .chroma .nb { + color: #04a5e5; + } + /* NameBuiltinPseudo */ + .chroma .bp { + color: #04a5e5; + } + /* NameClass */ + .chroma .nc { + color: #df8e1d; + } + /* NameConstant */ + .chroma .no { + color: #df8e1d; + } + /* NameDecorator */ + .chroma .nd { + color: #1e66f5; + font-weight: bold; + } + /* NameEntity */ + .chroma .ni { + color: #179299; + } + /* NameException */ + .chroma .ne { + color: #fe640b; + } + /* NameFunction */ + .chroma .nf { + color: #1e66f5; + } + /* NameFunctionMagic */ + .chroma .fm { + color: #1e66f5; + } + /* NameLabel */ + .chroma .nl { + color: #04a5e5; + } + /* NameNamespace */ + .chroma .nn { + color: #fe640b; + } + /* NameOther */ + .chroma .nx { + } + /* NameProperty */ + .chroma .py { + color: #fe640b; + } + /* NameTag */ + .chroma .nt { + color: #8839ef; + } + /* NameVariable */ + .chroma .nv { + color: #dc8a78; + } + /* NameVariableClass */ + .chroma .vc { + color: #dc8a78; + } + /* NameVariableGlobal */ + .chroma .vg { + color: #dc8a78; + } + /* NameVariableInstance */ + .chroma .vi { + color: #dc8a78; + } + /* NameVariableMagic */ + .chroma .vm { + color: #dc8a78; + } + /* Literal */ + .chroma .l { + } + /* LiteralDate */ + .chroma .ld { + } + /* LiteralString */ + .chroma .s { + color: #40a02b; + } + /* LiteralStringAffix */ + .chroma .sa { + color: #d20f39; + } + /* LiteralStringBacktick */ + .chroma .sb { + color: #40a02b; + } + /* LiteralStringChar */ + .chroma .sc { + color: #40a02b; + } + /* LiteralStringDelimiter */ + .chroma .dl { + color: #1e66f5; + } + /* LiteralStringDoc */ + .chroma .sd { + color: #9ca0b0; + } + /* LiteralStringDouble */ + .chroma .s2 { + color: #40a02b; + } + /* LiteralStringEscape */ + .chroma .se { + color: #1e66f5; + } + /* LiteralStringHeredoc */ + .chroma .sh { + color: #9ca0b0; + } + /* LiteralStringInterpol */ + .chroma .si { + color: #40a02b; + } + /* LiteralStringOther */ + .chroma .sx { + color: #40a02b; + } + /* LiteralStringRegex */ + .chroma .sr { + color: #179299; + } + /* LiteralStringSingle */ + .chroma .s1 { + color: #40a02b; + } + /* LiteralStringSymbol */ + .chroma .ss { + color: #40a02b; + } + /* LiteralNumber */ + .chroma .m { + color: #fe640b; + } + /* LiteralNumberBin */ + .chroma .mb { + color: #fe640b; + } + /* LiteralNumberFloat */ + .chroma .mf { + color: #fe640b; + } + /* LiteralNumberHex */ + .chroma .mh { + color: #fe640b; + } + /* LiteralNumberInteger */ + .chroma .mi { + color: #fe640b; + } + /* LiteralNumberIntegerLong */ + .chroma .il { + color: #fe640b; + } + /* LiteralNumberOct */ + .chroma .mo { + color: #fe640b; + } + /* Operator */ + .chroma .o { + color: #04a5e5; + font-weight: bold; + } + /* OperatorWord */ + .chroma .ow { + color: #04a5e5; + font-weight: bold; + } + /* Punctuation */ + .chroma .p { + } + /* Comment */ + .chroma .c { + color: #9ca0b0; + font-style: italic; + } + /* CommentHashbang */ + .chroma .ch { + color: #9ca0b0; + font-style: italic; + } + /* CommentMultiline */ + .chroma .cm { + color: #9ca0b0; + font-style: italic; + } + /* CommentSingle */ + .chroma .c1 { + color: #9ca0b0; + font-style: italic; + } + /* CommentSpecial */ + .chroma .cs { + color: #9ca0b0; + font-style: italic; + } + /* CommentPreproc */ + .chroma .cp { + color: #9ca0b0; + font-style: italic; + } + /* CommentPreprocFile */ + .chroma .cpf { + color: #9ca0b0; + font-weight: bold; + font-style: italic; + } + /* Generic */ + .chroma .g { + } + /* GenericDeleted */ + .chroma .gd { + color: #d20f39; + background-color: #ccd0da; + } + /* GenericEmph */ + .chroma .ge { + font-style: italic; + } + /* GenericError */ + .chroma .gr { + color: #d20f39; + } + /* GenericHeading */ + .chroma .gh { + color: #fe640b; + font-weight: bold; + } + /* GenericInserted */ + .chroma .gi { + color: #40a02b; + background-color: #ccd0da; + } + /* GenericOutput */ + .chroma .go { + } + /* GenericPrompt */ + .chroma .gp { + } + /* GenericStrong */ + .chroma .gs { + font-weight: bold; + } + /* GenericSubheading */ + .chroma .gu { + color: #fe640b; + font-weight: bold; + } + /* GenericTraceback */ + .chroma .gt { + color: #d20f39; + } + /* GenericUnderline */ + .chroma .gl { + text-decoration: underline; + } + /* TextWhitespace */ + .chroma .w { + } +} diff --git a/assets/css/themes/syntax-onedark.scss b/assets/css/themes/syntax-onedark.scss index a2223265e..f80de1919 100644 --- a/assets/css/themes/syntax-onedark.scss +++ b/assets/css/themes/syntax-onedark.scss @@ -1,89 +1,353 @@ // hugo gen chromastyles --style=onedark > syntax.css .dark { -/* Background */ .bg { color:#abb2bf;background-color:#282c34; } -/* PreWrapper */ .chroma { color:#abb2bf;background-color:#282c34; } -/* Other */ .chroma .x { } -/* Error */ .chroma .err { } -/* CodeLine */ .chroma .cl { } -/* LineLink */ .chroma .lnlinks { outline:none;text-decoration:none;color:inherit } -/* LineTableTD */ .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; } -/* LineTable */ .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; } -/* LineHighlight */ .chroma .hl { background-color:#3d4148 } -/* LineNumbersTable */ .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#55595f } -/* LineNumbers */ .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#55595f } -/* Line */ .chroma .line { display:flex; } -/* Keyword */ .chroma .k { color:#c678dd } -/* KeywordConstant */ .chroma .kc { color:#e5c07b } -/* KeywordDeclaration */ .chroma .kd { color:#c678dd } -/* KeywordNamespace */ .chroma .kn { color:#c678dd } -/* KeywordPseudo */ .chroma .kp { color:#c678dd } -/* KeywordReserved */ .chroma .kr { color:#c678dd } -/* KeywordType */ .chroma .kt { color:#e5c07b } -/* Name */ .chroma .n { color:#e06c75 } -/* NameAttribute */ .chroma .na { color:#e06c75 } -/* NameBuiltin */ .chroma .nb { color:#e5c07b } -/* NameBuiltinPseudo */ .chroma .bp { color:#e06c75 } -/* NameClass */ .chroma .nc { color:#e5c07b } -/* NameConstant */ .chroma .no { color:#e06c75 } -/* NameDecorator */ .chroma .nd { color:#61afef } -/* NameEntity */ .chroma .ni { color:#e06c75 } -/* NameException */ .chroma .ne { color:#e06c75 } -/* NameFunction */ .chroma .nf { color:#61afef;font-weight:bold } -/* NameFunctionMagic */ .chroma .fm { color:#56b6c2;font-weight:bold } -/* NameLabel */ .chroma .nl { color:#e06c75 } -/* NameNamespace */ .chroma .nn { color:#e06c75 } -/* NameOther */ .chroma .nx { color:#e06c75 } -/* NameProperty */ .chroma .py { color:#e06c75 } -/* NameTag */ .chroma .nt { color:#e06c75 } -/* NameVariable */ .chroma .nv { color:#e06c75 } -/* NameVariableClass */ .chroma .vc { color:#e06c75 } -/* NameVariableGlobal */ .chroma .vg { color:#e06c75 } -/* NameVariableInstance */ .chroma .vi { color:#e06c75 } -/* NameVariableMagic */ .chroma .vm { color:#e06c75 } -/* Literal */ .chroma .l { } -/* LiteralDate */ .chroma .ld { } -/* LiteralString */ .chroma .s { color:#98c379 } -/* LiteralStringAffix */ .chroma .sa { color:#98c379 } -/* LiteralStringBacktick */ .chroma .sb { color:#98c379 } -/* LiteralStringChar */ .chroma .sc { color:#98c379 } -/* LiteralStringDelimiter */ .chroma .dl { color:#98c379 } -/* LiteralStringDoc */ .chroma .sd { color:#98c379 } -/* LiteralStringDouble */ .chroma .s2 { color:#98c379 } -/* LiteralStringEscape */ .chroma .se { color:#98c379 } -/* LiteralStringHeredoc */ .chroma .sh { color:#98c379 } -/* LiteralStringInterpol */ .chroma .si { color:#98c379 } -/* LiteralStringOther */ .chroma .sx { color:#98c379 } -/* LiteralStringRegex */ .chroma .sr { color:#98c379 } -/* LiteralStringSingle */ .chroma .s1 { color:#98c379 } -/* LiteralStringSymbol */ .chroma .ss { color:#98c379 } -/* LiteralNumber */ .chroma .m { color:#d19a66 } -/* LiteralNumberBin */ .chroma .mb { color:#d19a66 } -/* LiteralNumberFloat */ .chroma .mf { color:#d19a66 } -/* LiteralNumberHex */ .chroma .mh { color:#d19a66 } -/* LiteralNumberInteger */ .chroma .mi { color:#d19a66 } -/* LiteralNumberIntegerLong */ .chroma .il { color:#d19a66 } -/* LiteralNumberOct */ .chroma .mo { color:#d19a66 } -/* Operator */ .chroma .o { color:#56b6c2 } -/* OperatorWord */ .chroma .ow { color:#56b6c2 } -/* Punctuation */ .chroma .p { } -/* Comment */ .chroma .c { color:#7f848e } -/* CommentHashbang */ .chroma .ch { color:#7f848e } -/* CommentMultiline */ .chroma .cm { color:#7f848e } -/* CommentSingle */ .chroma .c1 { color:#7f848e } -/* CommentSpecial */ .chroma .cs { color:#7f848e } -/* CommentPreproc */ .chroma .cp { color:#7f848e } -/* CommentPreprocFile */ .chroma .cpf { color:#7f848e } -/* Generic */ .chroma .g { } -/* GenericDeleted */ .chroma .gd { color:#e06c75 } -/* GenericEmph */ .chroma .ge { } -/* GenericError */ .chroma .gr { } -/* GenericHeading */ .chroma .gh { } -/* GenericInserted */ .chroma .gi { color:#98c379;font-weight:bold } -/* GenericOutput */ .chroma .go { } -/* GenericPrompt */ .chroma .gp { } -/* GenericStrong */ .chroma .gs { } -/* GenericSubheading */ .chroma .gu { } -/* GenericTraceback */ .chroma .gt { } -/* GenericUnderline */ .chroma .gl { } -/* TextWhitespace */ .chroma .w { } -} \ No newline at end of file + /* Background */ + .bg { + color: #abb2bf; + background-color: #282c34; + } + /* PreWrapper */ + .chroma { + color: #abb2bf; + background-color: #282c34; + } + /* Other */ + .chroma .x { + } + /* Error */ + .chroma .err { + } + /* CodeLine */ + .chroma .cl { + } + /* LineLink */ + .chroma .lnlinks { + outline: none; + text-decoration: none; + color: inherit; + } + /* LineTableTD */ + .chroma .lntd { + vertical-align: top; + padding: 0; + margin: 0; + border: 0; + } + /* LineTable */ + .chroma .lntable { + border-spacing: 0; + padding: 0; + margin: 0; + border: 0; + } + /* LineHighlight */ + .chroma .hl { + background-color: #3d4148; + } + /* LineNumbersTable */ + .chroma .lnt { + white-space: pre; + -webkit-user-select: none; + user-select: none; + margin-right: 0.4em; + padding: 0 0.4em 0 0.4em; + color: #55595f; + } + /* LineNumbers */ + .chroma .ln { + white-space: pre; + -webkit-user-select: none; + user-select: none; + margin-right: 0.4em; + padding: 0 0.4em 0 0.4em; + color: #55595f; + } + /* Line */ + .chroma .line { + display: flex; + } + /* Keyword */ + .chroma .k { + color: #c678dd; + } + /* KeywordConstant */ + .chroma .kc { + color: #e5c07b; + } + /* KeywordDeclaration */ + .chroma .kd { + color: #c678dd; + } + /* KeywordNamespace */ + .chroma .kn { + color: #c678dd; + } + /* KeywordPseudo */ + .chroma .kp { + color: #c678dd; + } + /* KeywordReserved */ + .chroma .kr { + color: #c678dd; + } + /* KeywordType */ + .chroma .kt { + color: #e5c07b; + } + /* Name */ + .chroma .n { + color: #e06c75; + } + /* NameAttribute */ + .chroma .na { + color: #e06c75; + } + /* NameBuiltin */ + .chroma .nb { + color: #e5c07b; + } + /* NameBuiltinPseudo */ + .chroma .bp { + color: #e06c75; + } + /* NameClass */ + .chroma .nc { + color: #e5c07b; + } + /* NameConstant */ + .chroma .no { + color: #e06c75; + } + /* NameDecorator */ + .chroma .nd { + color: #61afef; + } + /* NameEntity */ + .chroma .ni { + color: #e06c75; + } + /* NameException */ + .chroma .ne { + color: #e06c75; + } + /* NameFunction */ + .chroma .nf { + color: #61afef; + font-weight: bold; + } + /* NameFunctionMagic */ + .chroma .fm { + color: #56b6c2; + font-weight: bold; + } + /* NameLabel */ + .chroma .nl { + color: #e06c75; + } + /* NameNamespace */ + .chroma .nn { + color: #e06c75; + } + /* NameOther */ + .chroma .nx { + color: #e06c75; + } + /* NameProperty */ + .chroma .py { + color: #e06c75; + } + /* NameTag */ + .chroma .nt { + color: #e06c75; + } + /* NameVariable */ + .chroma .nv { + color: #e06c75; + } + /* NameVariableClass */ + .chroma .vc { + color: #e06c75; + } + /* NameVariableGlobal */ + .chroma .vg { + color: #e06c75; + } + /* NameVariableInstance */ + .chroma .vi { + color: #e06c75; + } + /* NameVariableMagic */ + .chroma .vm { + color: #e06c75; + } + /* Literal */ + .chroma .l { + } + /* LiteralDate */ + .chroma .ld { + } + /* LiteralString */ + .chroma .s { + color: #98c379; + } + /* LiteralStringAffix */ + .chroma .sa { + color: #98c379; + } + /* LiteralStringBacktick */ + .chroma .sb { + color: #98c379; + } + /* LiteralStringChar */ + .chroma .sc { + color: #98c379; + } + /* LiteralStringDelimiter */ + .chroma .dl { + color: #98c379; + } + /* LiteralStringDoc */ + .chroma .sd { + color: #98c379; + } + /* LiteralStringDouble */ + .chroma .s2 { + color: #98c379; + } + /* LiteralStringEscape */ + .chroma .se { + color: #98c379; + } + /* LiteralStringHeredoc */ + .chroma .sh { + color: #98c379; + } + /* LiteralStringInterpol */ + .chroma .si { + color: #98c379; + } + /* LiteralStringOther */ + .chroma .sx { + color: #98c379; + } + /* LiteralStringRegex */ + .chroma .sr { + color: #98c379; + } + /* LiteralStringSingle */ + .chroma .s1 { + color: #98c379; + } + /* LiteralStringSymbol */ + .chroma .ss { + color: #98c379; + } + /* LiteralNumber */ + .chroma .m { + color: #d19a66; + } + /* LiteralNumberBin */ + .chroma .mb { + color: #d19a66; + } + /* LiteralNumberFloat */ + .chroma .mf { + color: #d19a66; + } + /* LiteralNumberHex */ + .chroma .mh { + color: #d19a66; + } + /* LiteralNumberInteger */ + .chroma .mi { + color: #d19a66; + } + /* LiteralNumberIntegerLong */ + .chroma .il { + color: #d19a66; + } + /* LiteralNumberOct */ + .chroma .mo { + color: #d19a66; + } + /* Operator */ + .chroma .o { + color: #56b6c2; + } + /* OperatorWord */ + .chroma .ow { + color: #56b6c2; + } + /* Punctuation */ + .chroma .p { + } + /* Comment */ + .chroma .c { + color: #7f848e; + } + /* CommentHashbang */ + .chroma .ch { + color: #7f848e; + } + /* CommentMultiline */ + .chroma .cm { + color: #7f848e; + } + /* CommentSingle */ + .chroma .c1 { + color: #7f848e; + } + /* CommentSpecial */ + .chroma .cs { + color: #7f848e; + } + /* CommentPreproc */ + .chroma .cp { + color: #7f848e; + } + /* CommentPreprocFile */ + .chroma .cpf { + color: #7f848e; + } + /* Generic */ + .chroma .g { + } + /* GenericDeleted */ + .chroma .gd { + color: #e06c75; + } + /* GenericEmph */ + .chroma .ge { + } + /* GenericError */ + .chroma .gr { + } + /* GenericHeading */ + .chroma .gh { + } + /* GenericInserted */ + .chroma .gi { + color: #98c379; + font-weight: bold; + } + /* GenericOutput */ + .chroma .go { + } + /* GenericPrompt */ + .chroma .gp { + } + /* GenericStrong */ + .chroma .gs { + } + /* GenericSubheading */ + .chroma .gu { + } + /* GenericTraceback */ + .chroma .gt { + } + /* GenericUnderline */ + .chroma .gl { + } + /* TextWhitespace */ + .chroma .w { + } +} diff --git a/assets/data/emoji/apple.yml b/assets/data/emoji/apple.yml index 3f9cee9d7..c451a4021 100644 --- a/assets/data/emoji/apple.yml +++ b/assets/data/emoji/apple.yml @@ -1,6 +1,6 @@ -emojiCDN: 'https://cdn.jsdelivr.net/npm/emoji-datasource-apple@5.0.1/img/apple/64/' +emojiCDN: "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@5.0.1/img/apple/64/" emojiMaps: - '100': 1f4af.png + "100": 1f4af.png grinning: 1f600.png smiley: 1f603.png smile: 1f604.png diff --git a/assets/data/emoji/facebook.yml b/assets/data/emoji/facebook.yml index f987491c6..2f9853c9e 100644 --- a/assets/data/emoji/facebook.yml +++ b/assets/data/emoji/facebook.yml @@ -1,6 +1,6 @@ -emojiCDN: 'https://cdn.jsdelivr.net/npm/emoji-datasource-facebook@5.0.1/img/facebook/64/' +emojiCDN: "https://cdn.jsdelivr.net/npm/emoji-datasource-facebook@5.0.1/img/facebook/64/" emojiMaps: - '100': 1f4af.png + "100": 1f4af.png grinning: 1f600.png smiley: 1f603.png smile: 1f604.png diff --git a/assets/data/emoji/google.yml b/assets/data/emoji/google.yml index 7137ccb9d..e8054f0ca 100644 --- a/assets/data/emoji/google.yml +++ b/assets/data/emoji/google.yml @@ -1,6 +1,6 @@ -emojiCDN: 'https://cdn.jsdelivr.net/npm/emoji-datasource-google@5.0.1/img/google/64/' +emojiCDN: "https://cdn.jsdelivr.net/npm/emoji-datasource-google@5.0.1/img/google/64/" emojiMaps: - '100': 1f4af.png + "100": 1f4af.png grinning: 1f600.png smiley: 1f603.png smile: 1f604.png diff --git a/assets/data/emoji/twitter.yml b/assets/data/emoji/twitter.yml index 97365c603..d8df81293 100644 --- a/assets/data/emoji/twitter.yml +++ b/assets/data/emoji/twitter.yml @@ -1,6 +1,6 @@ -emojiCDN: 'https://cdn.jsdelivr.net/npm/emoji-datasource-twitter@5.0.1/img/twitter/64/' +emojiCDN: "https://cdn.jsdelivr.net/npm/emoji-datasource-twitter@5.0.1/img/twitter/64/" emojiMaps: - '100': 1f4af.png + "100": 1f4af.png grinning: 1f600.png smiley: 1f603.png smile: 1f604.png diff --git a/assets/data/social.yml b/assets/data/social.yml index ec71052b1..148226298 100644 --- a/assets/data/social.yml +++ b/assets/data/social.yml @@ -716,4 +716,4 @@ rss: Icon: Fontawesome: Style: solid - Icon: rss \ No newline at end of file + Icon: rss diff --git a/assets/js/lib/aplayer.js b/assets/js/lib/aplayer.js index 524be6cda..c76c986cd 100644 --- a/assets/js/lib/aplayer.js +++ b/assets/js/lib/aplayer.js @@ -1,16 +1,15 @@ /* eslint-disable no-new */ -import APlayer from 'aplayer' +import APlayer from "aplayer"; -const aplayerInstances = [] +const aplayerInstances = []; // Get all aplayer containers -const aplayers = document.getElementsByClassName('aplayer-shortcode') -Array.from(aplayers).forEach(aplayer => { - const audio = JSON.parse(aplayer.dataset.audio) - const options = JSON.parse(aplayer.dataset.options) - options.audio = audio - options.container = aplayer - const ap = new APlayer(options) - aplayerInstances.push(ap) -}) - +const aplayers = document.getElementsByClassName("aplayer-shortcode"); +Array.from(aplayers).forEach((aplayer) => { + const audio = JSON.parse(aplayer.dataset.audio); + const options = JSON.parse(aplayer.dataset.options); + options.audio = audio; + options.container = aplayer; + const ap = new APlayer(options); + aplayerInstances.push(ap); +}); diff --git a/assets/js/lib/artalk.js b/assets/js/lib/artalk.js index 0d4e6f187..e558eedc4 100644 --- a/assets/js/lib/artalk.js +++ b/assets/js/lib/artalk.js @@ -1,13 +1,13 @@ -import Artalk from 'artalk' +import Artalk from "artalk"; if (window.config?.comment) { - const config = window.config.comment.artalk + const config = window.config.comment.artalk; if (config) { - const artalk = Artalk.init(config) - artalk.setDarkMode(window.isDark) + const artalk = Artalk.init(config); + artalk.setDarkMode(window.isDark); window._artalkOnSwitchTheme = () => { - artalk.setDarkMode(window.isDark) - } - window.switchThemeEventSet.add(window._artalkOnSwitchTheme) + artalk.setDarkMode(window.isDark); + }; + window.switchThemeEventSet.add(window._artalkOnSwitchTheme); } } diff --git a/assets/js/lib/cookieconsent.js b/assets/js/lib/cookieconsent.js index ce638fe5a..6abd8c3fd 100644 --- a/assets/js/lib/cookieconsent.js +++ b/assets/js/lib/cookieconsent.js @@ -1,9 +1,9 @@ -import cookieconsent from 'cookieconsent' +import cookieconsent from "cookieconsent"; if (window.config?.cookieconsent) { - const container = document.getElementById('cookieconsent-container') + const container = document.getElementById("cookieconsent-container"); // if there is nothing in the container, then init the cookieconsent - if (container.innerHTML === '') { - cookieconsent.initialise(window.config.cookieconsent) + if (container.innerHTML === "") { + cookieconsent.initialise(window.config.cookieconsent); } } diff --git a/assets/js/lib/echarts.js b/assets/js/lib/echarts.js index 22bc993bc..891e65c68 100644 --- a/assets/js/lib/echarts.js +++ b/assets/js/lib/echarts.js @@ -1,5 +1,5 @@ -import params from '@params' -import * as echarts from 'echarts' +import params from "@params"; +import * as echarts from "echarts"; if (params.bundle === true) { // // Import themes // import 'echarts/theme/macarons.js' @@ -22,7 +22,6 @@ if (params.bundle === true) { // // Import the Canvas renderer // // Note that introducing the CanvasRenderer or SVGRenderer is a required step // import { CanvasRenderer } from 'echarts/renderers' - // // Register the required components // echarts.use([ // TitleComponent, @@ -39,22 +38,22 @@ if (params.bundle === true) { } window._echartsOnSwitchTheme = () => { - window._echartsArr = window._echartsArr || [] + window._echartsArr = window._echartsArr || []; for (let i = 0; i < window._echartsArr.length; i++) { - window._echartsArr[i].dispose() + window._echartsArr[i].dispose(); } - window._echartsArr = [] - Array.from(document.getElementsByClassName('echarts')).forEach(e => { - const chart = echarts.init(e, window.isDark ? 'dark' : 'macarons') - chart.setOption(JSON.parse(window.config.data[e.id])) - window._echartsArr.push(chart) - }) -} -window.switchThemeEventSet.add(window._echartsOnSwitchTheme) -window._echartsOnSwitchTheme() + window._echartsArr = []; + Array.from(document.getElementsByClassName("echarts")).forEach((e) => { + const chart = echarts.init(e, window.isDark ? "dark" : "macarons"); + chart.setOption(JSON.parse(window.config.data[e.id])); + window._echartsArr.push(chart); + }); +}; +window.switchThemeEventSet.add(window._echartsOnSwitchTheme); +window._echartsOnSwitchTheme(); window._echartsOnResize = () => { for (let i = 0; i < window._echartsArr.length; i++) { - window._echartsArr[i].resize() + window._echartsArr[i].resize(); } -} -window.resizeEventSet.add(window._echartsOnResize) +}; +window.resizeEventSet.add(window._echartsOnResize); diff --git a/assets/js/lib/giscus.js b/assets/js/lib/giscus.js index 8043ff3d7..e3b20a35a 100644 --- a/assets/js/lib/giscus.js +++ b/assets/js/lib/giscus.js @@ -1,33 +1,42 @@ if (window.config?.comment?.giscus) { - const giscusConfig = window.config.comment.giscus - const script = document.createElement('script') - script.src = 'https://giscus.app/client.js' - script.type = 'text/javascript' - script.setAttribute('data-repo', giscusConfig.dataRepo) - script.setAttribute('data-repo-id', giscusConfig.dataRepoId) - if (giscusConfig.dataCategory) script.setAttribute('data-category', giscusConfig.dataCategory) - script.setAttribute('data-category-id', giscusConfig.dataCategoryId) - script.setAttribute('data-mapping', giscusConfig.dataMapping) - script.setAttribute('data-reactions-enabled', giscusConfig.dataReactionsEnabled) - script.setAttribute('data-emit-metadata', giscusConfig.dataEmitMetadata) - script.setAttribute('data-input-position', giscusConfig.dataInputPosition) - script.setAttribute('data-theme', window.isDark ? giscusConfig.darkTheme : giscusConfig.lightTheme) - script.setAttribute('data-lang', giscusConfig.dataLang) - script.setAttribute('data-strict', giscusConfig.dataStrict) - script.setAttribute('data-loading', giscusConfig.dataLoading) - script.crossOrigin = 'anonymous' - script.async = true - document.getElementById('giscus').appendChild(script) + const giscusConfig = window.config.comment.giscus; + const script = document.createElement("script"); + script.src = "https://giscus.app/client.js"; + script.type = "text/javascript"; + script.setAttribute("data-repo", giscusConfig.dataRepo); + script.setAttribute("data-repo-id", giscusConfig.dataRepoId); + if (giscusConfig.dataCategory) + script.setAttribute("data-category", giscusConfig.dataCategory); + script.setAttribute("data-category-id", giscusConfig.dataCategoryId); + script.setAttribute("data-mapping", giscusConfig.dataMapping); + script.setAttribute( + "data-reactions-enabled", + giscusConfig.dataReactionsEnabled, + ); + script.setAttribute("data-emit-metadata", giscusConfig.dataEmitMetadata); + script.setAttribute("data-input-position", giscusConfig.dataInputPosition); + script.setAttribute( + "data-theme", + window.isDark ? giscusConfig.darkTheme : giscusConfig.lightTheme, + ); + script.setAttribute("data-lang", giscusConfig.dataLang); + script.setAttribute("data-strict", giscusConfig.dataStrict); + script.setAttribute("data-loading", giscusConfig.dataLoading); + script.crossOrigin = "anonymous"; + script.async = true; + document.getElementById("giscus").appendChild(script); window._giscusOnSwitchTheme = () => { const message = { giscus: { setConfig: { - theme: window.isDark ? giscusConfig.darkTheme : giscusConfig.lightTheme - } - } - } - const iframe = document.querySelector('.giscus-frame') - iframe.contentWindow.postMessage(message, 'https://giscus.app') - } - window.switchThemeEventSet.add(window._giscusOnSwitchTheme) + theme: window.isDark + ? giscusConfig.darkTheme + : giscusConfig.lightTheme, + }, + }, + }; + const iframe = document.querySelector(".giscus-frame"); + iframe.contentWindow.postMessage(message, "https://giscus.app"); + }; + window.switchThemeEventSet.add(window._giscusOnSwitchTheme); } diff --git a/assets/js/lib/gitalk.js b/assets/js/lib/gitalk.js index 7019574f2..cf6afddea 100644 --- a/assets/js/lib/gitalk.js +++ b/assets/js/lib/gitalk.js @@ -1,6 +1,6 @@ /* eslint-disable no-undef */ if (window.config?.comment?.gitalk) { - window.config.comment.gitalk.body = decodeURI(window.location.href) - const gitalk = new Gitalk(window.config.comment.gitalk) - gitalk.render('gitalk') + window.config.comment.gitalk.body = decodeURI(window.location.href); + const gitalk = new Gitalk(window.config.comment.gitalk); + gitalk.render("gitalk"); } diff --git a/assets/js/lib/katex.js b/assets/js/lib/katex.js index 079501191..3f1fcdd22 100644 --- a/assets/js/lib/katex.js +++ b/assets/js/lib/katex.js @@ -1,10 +1,10 @@ -import renderMathInElement from 'katex/dist/contrib/auto-render' +import renderMathInElement from "katex/dist/contrib/auto-render"; if (window.config?.math) { // ignore comment section if exists // https://github.com/HEIGE-PCloud/DoIt/issues/487 - if (document.getElementsByClassName('comment')) { - window.config.math.ignoredClasses = ['comment'] + if (document.getElementsByClassName("comment")) { + window.config.math.ignoredClasses = ["comment"]; } - renderMathInElement(document.body, window.config.math) + renderMathInElement(document.body, window.config.math); } diff --git a/assets/js/lib/mathjax.js b/assets/js/lib/mathjax.js index bab585cca..6c1257397 100644 --- a/assets/js/lib/mathjax.js +++ b/assets/js/lib/mathjax.js @@ -1,12 +1,16 @@ -const delimiters = window.config?.math?.delimiters +const delimiters = window.config?.math?.delimiters; if (!delimiters) { return; } -const displayMath = delimiters.filter(d => d.display).map(d => [d.left, d.right]) -const inlineMath = delimiters.filter(d => !d.display).map(d => [d.left, d.right]) +const displayMath = delimiters + .filter((d) => d.display) + .map((d) => [d.left, d.right]); +const inlineMath = delimiters + .filter((d) => !d.display) + .map((d) => [d.left, d.right]); window.MathJax = { tex: { displayMath, - inlineMath - } + inlineMath, + }, }; diff --git a/assets/js/lib/remark42.js b/assets/js/lib/remark42.js index de23ec998..c6e581493 100644 --- a/assets/js/lib/remark42.js +++ b/assets/js/lib/remark42.js @@ -1,26 +1,36 @@ if (window.config?.comment?.remark42) { - const remark42 = window.config.comment.remark42 + const remark42 = window.config.comment.remark42; // eslint-disable-next-line camelcase const remark_config = { host: remark42.host, site_id: remark42.site_id, - components: ['embed'], + components: ["embed"], max_shown_comments: remark42.max_shown_comments, - theme: window.isDark ? 'dark' : 'light', + theme: window.isDark ? "dark" : "light", locale: remark42.locale, show_email_subscription: remark42.show_email_subscription, - simple_view: remark42.simple_view - } + simple_view: remark42.simple_view, + }; // eslint-disable-next-line camelcase - window.remark_config = remark_config + window.remark_config = remark_config; // eslint-disable-next-line no-sequences, no-unused-expressions - !(function (e, n) { for (let o = 0; o < e.length; o++) { const r = n.createElement('script'); let c = '.js'; const d = n.head || n.body; 'noModule' in r ? (r.type = 'module', c = '.mjs') : r.async = !0, r.defer = !0, r.src = remark_config.host + '/web/' + e[o] + c, d.appendChild(r) } }(remark_config.components || ['embed'], document)) + !(function (e, n) { + for (let o = 0; o < e.length; o++) { + const r = n.createElement("script"); + let c = ".js"; + const d = n.head || n.body; + "noModule" in r ? ((r.type = "module"), (c = ".mjs")) : (r.async = !0), + (r.defer = !0), + (r.src = remark_config.host + "/web/" + e[o] + c), + d.appendChild(r); + } + })(remark_config.components || ["embed"], document); window._remark42OnSwitchTheme = () => { if (window.isDark) { - window.REMARK42.changeTheme('dark') + window.REMARK42.changeTheme("dark"); } else { - window.REMARK42.changeTheme('light') + window.REMARK42.changeTheme("light"); } - } - window.switchThemeEventSet.add(window._remark42OnSwitchTheme) + }; + window.switchThemeEventSet.add(window._remark42OnSwitchTheme); } diff --git a/assets/js/lib/twemoji.js b/assets/js/lib/twemoji.js index 990430bb7..9b5befec3 100644 --- a/assets/js/lib/twemoji.js +++ b/assets/js/lib/twemoji.js @@ -1,3 +1,3 @@ -import twemoji from 'twemoji' +import twemoji from "twemoji"; -if (window.config?.twemoji) twemoji.parse(document.body) +if (window.config?.twemoji) twemoji.parse(document.body); diff --git a/assets/js/lib/twikoo.js b/assets/js/lib/twikoo.js index f82a877ab..901547602 100644 --- a/assets/js/lib/twikoo.js +++ b/assets/js/lib/twikoo.js @@ -1,28 +1,31 @@ -const twikoo = require('twikoo') +const twikoo = require("twikoo"); if (window.config?.comment) { - const config = window.config.comment.twikoo + const config = window.config.comment.twikoo; if (config) { - twikoo.init(config) + twikoo.init(config); if (config.commentCount) { // https://twikoo.js.org/api.html#get-comments-count - twikoo.getCommentsCount({ - envId: config.envId, - region: config.region, - urls: [ - window.location.pathname - ], - includeReply: false - }).then(function (response) { - // example: [ - // { url: '/2020/10/post-1.html', count: 10 }, - // { url: '/2020/11/post-2.html', count: 0 }, - // { url: '/2020/12/post-3.html', count: 20 } - // ] - // If there is an element with id="twikoo-comment-count", set its innerHTML to the count of comments - const twikooCommentCount = document.getElementById('twikoo-comment-count') - if (twikooCommentCount) twikooCommentCount.innerHTML = response[0].count - }) + twikoo + .getCommentsCount({ + envId: config.envId, + region: config.region, + urls: [window.location.pathname], + includeReply: false, + }) + .then(function (response) { + // example: [ + // { url: '/2020/10/post-1.html', count: 10 }, + // { url: '/2020/11/post-2.html', count: 0 }, + // { url: '/2020/12/post-3.html', count: 20 } + // ] + // If there is an element with id="twikoo-comment-count", set its innerHTML to the count of comments + const twikooCommentCount = document.getElementById( + "twikoo-comment-count", + ); + if (twikooCommentCount) + twikooCommentCount.innerHTML = response[0].count; + }); } } } diff --git a/assets/js/lib/utterances.js b/assets/js/lib/utterances.js index 2888768f0..5890c9224 100644 --- a/assets/js/lib/utterances.js +++ b/assets/js/lib/utterances.js @@ -1,22 +1,28 @@ if (window.config?.comment?.utterances) { - const utterancesConfig = window.config.comment.utterances - const script = document.createElement('script') - script.src = 'https://utteranc.es/client.js' - script.type = 'text/javascript' - script.setAttribute('repo', utterancesConfig.repo) - script.setAttribute('issue-term', utterancesConfig.issueTerm) - if (utterancesConfig.label) script.setAttribute('label', utterancesConfig.label) - script.setAttribute('theme', window.isDark ? utterancesConfig.darkTheme : utterancesConfig.lightTheme) - script.crossOrigin = 'anonymous' - script.async = true - document.getElementById('utterances').appendChild(script) + const utterancesConfig = window.config.comment.utterances; + const script = document.createElement("script"); + script.src = "https://utteranc.es/client.js"; + script.type = "text/javascript"; + script.setAttribute("repo", utterancesConfig.repo); + script.setAttribute("issue-term", utterancesConfig.issueTerm); + if (utterancesConfig.label) + script.setAttribute("label", utterancesConfig.label); + script.setAttribute( + "theme", + window.isDark ? utterancesConfig.darkTheme : utterancesConfig.lightTheme, + ); + script.crossOrigin = "anonymous"; + script.async = true; + document.getElementById("utterances").appendChild(script); window._utterancesOnSwitchTheme = () => { const message = { - type: 'set-theme', - theme: window.isDark ? utterancesConfig.darkTheme : utterancesConfig.lightTheme - } - const iframe = document.querySelector('.utterances-frame') - iframe.contentWindow.postMessage(message, 'https://utteranc.es') - } - window.switchThemeEventSet.add(window._utterancesOnSwitchTheme) + type: "set-theme", + theme: window.isDark + ? utterancesConfig.darkTheme + : utterancesConfig.lightTheme, + }; + const iframe = document.querySelector(".utterances-frame"); + iframe.contentWindow.postMessage(message, "https://utteranc.es"); + }; + window.switchThemeEventSet.add(window._utterancesOnSwitchTheme); } diff --git a/assets/js/lib/valine.js b/assets/js/lib/valine.js index 9a6bae653..0447aa0bf 100644 --- a/assets/js/lib/valine.js +++ b/assets/js/lib/valine.js @@ -1,6 +1,6 @@ /* eslint-disable no-new */ -import Valine from 'valine' +import Valine from "valine"; if (window.config?.comment?.valine) { - new Valine(window.config.comment.valine) + new Valine(window.config.comment.valine); } diff --git a/assets/js/lib/vssue.js b/assets/js/lib/vssue.js index b4df48d73..09634b13d 100644 --- a/assets/js/lib/vssue.js +++ b/assets/js/lib/vssue.js @@ -1,19 +1,20 @@ /* eslint-disable no-undef */ /* eslint-disable no-new */ if (window.config?.comment?.vssue) { - const vssue = window.config.comment.vssue + const vssue = window.config.comment.vssue; new Vue({ el: vssue.el, - render: h => h('Vssue', { - props: { - title: vssue.title, - options: { - owner: vssue.owner, - repo: vssue.repo, - clientId: vssue.clientId, - clientSecret: vssue.clientSecret - } - } - }) - }) + render: (h) => + h("Vssue", { + props: { + title: vssue.title, + options: { + owner: vssue.owner, + repo: vssue.repo, + clientId: vssue.clientId, + clientSecret: vssue.clientSecret, + }, + }, + }), + }); } diff --git a/assets/js/lib/waline.js b/assets/js/lib/waline.js index 6e94cbea1..06bbb4190 100644 --- a/assets/js/lib/waline.js +++ b/assets/js/lib/waline.js @@ -1,5 +1,5 @@ -import { init } from '@waline/client' +import { init } from "@waline/client"; if (window.config?.comment?.waline) { - init(window.config.comment.waline) + init(window.config.comment.waline); } diff --git a/assets/js/shims/aplayer.js b/assets/js/shims/aplayer.js index 23aef206e..2b3775085 100644 --- a/assets/js/shims/aplayer.js +++ b/assets/js/shims/aplayer.js @@ -1 +1 @@ -module.exports = window.APlayer +module.exports = window.APlayer; diff --git a/assets/js/shims/artalk.js b/assets/js/shims/artalk.js index d427d3e73..c9b1e53d5 100644 --- a/assets/js/shims/artalk.js +++ b/assets/js/shims/artalk.js @@ -1 +1 @@ -module.exports = window.Artalk +module.exports = window.Artalk; diff --git a/assets/js/shims/cookieconsent.js b/assets/js/shims/cookieconsent.js index 4998d3d71..4fba01004 100644 --- a/assets/js/shims/cookieconsent.js +++ b/assets/js/shims/cookieconsent.js @@ -1 +1 @@ -module.exports = window.cookieconsent +module.exports = window.cookieconsent; diff --git a/assets/js/shims/echarts.js b/assets/js/shims/echarts.js index 139e49a95..6ffc179cb 100644 --- a/assets/js/shims/echarts.js +++ b/assets/js/shims/echarts.js @@ -1 +1 @@ -module.exports = window.echarts +module.exports = window.echarts; diff --git a/assets/js/shims/katex.js b/assets/js/shims/katex.js index eae0bdc20..a81dad4a6 100644 --- a/assets/js/shims/katex.js +++ b/assets/js/shims/katex.js @@ -1 +1 @@ -module.exports = window.renderMathInElement +module.exports = window.renderMathInElement; diff --git a/assets/js/shims/tablesort.js b/assets/js/shims/tablesort.js index 7d62004ca..6016a1fce 100644 --- a/assets/js/shims/tablesort.js +++ b/assets/js/shims/tablesort.js @@ -1 +1 @@ -module.exports = window.Tablesort +module.exports = window.Tablesort; diff --git a/assets/js/shims/twemoji.js b/assets/js/shims/twemoji.js index 1a8079727..d7576caf5 100644 --- a/assets/js/shims/twemoji.js +++ b/assets/js/shims/twemoji.js @@ -1 +1 @@ -module.exports = window.twemoji +module.exports = window.twemoji; diff --git a/assets/js/shims/twikoo.js b/assets/js/shims/twikoo.js index 382779bb7..caee3327a 100644 --- a/assets/js/shims/twikoo.js +++ b/assets/js/shims/twikoo.js @@ -1 +1 @@ -module.exports = window.twikoo +module.exports = window.twikoo; diff --git a/assets/js/shims/valine.js b/assets/js/shims/valine.js index d8ebf941b..ff6184987 100644 --- a/assets/js/shims/valine.js +++ b/assets/js/shims/valine.js @@ -1 +1 @@ -module.exports = window.Valine +module.exports = window.Valine; diff --git a/assets/js/shims/waline.js b/assets/js/shims/waline.js index e3d0c9d79..76746ba16 100644 --- a/assets/js/shims/waline.js +++ b/assets/js/shims/waline.js @@ -1 +1 @@ -module.exports = window.Waline +module.exports = window.Waline; diff --git a/assets/js/sw.js b/assets/js/sw.js index 853271de4..a419d69ab 100644 --- a/assets/js/sw.js +++ b/assets/js/sw.js @@ -1,69 +1,67 @@ -const CACHE_VERSION = 1 +const CACHE_VERSION = 1; const BASE_CACHE_FILES = [ - '/css/style.min.css', - '/js/theme.min.js', - '/site.webmanifest' -] + "/css/style.min.css", + "/js/theme.min.js", + "/site.webmanifest", +]; const OFFLINE_CACHE_FILES = [ - '/css/style.min.css', - '/js/theme.min.js', - '/site.webmanifest', - '/offline' -] + "/css/style.min.css", + "/js/theme.min.js", + "/site.webmanifest", + "/offline", +]; const NOT_FOUND_CACHE_FILES = [ - '/css/style.min.css', - '/js/theme.min.js', - '/site.webmanifest', - '/404.html' -] + "/css/style.min.css", + "/js/theme.min.js", + "/site.webmanifest", + "/404.html", +]; -const OFFLINE_PAGE = '/offline' -const NOT_FOUND_PAGE = '/404.html' +const OFFLINE_PAGE = "/offline"; +const NOT_FOUND_PAGE = "/404.html"; const CACHE_VERSIONS = { - assets: 'assets-v' + CACHE_VERSION, - content: 'content-v' + CACHE_VERSION, - offline: 'offline-v' + CACHE_VERSION, - notFound: '404-v' + CACHE_VERSION -} + assets: "assets-v" + CACHE_VERSION, + content: "content-v" + CACHE_VERSION, + offline: "offline-v" + CACHE_VERSION, + notFound: "404-v" + CACHE_VERSION, +}; // Define MAX_TTL's in SECONDS for specific file extensions const MAX_TTL = { - '/': 3600, + "/": 3600, html: 3600, json: 86400, js: 86400, - css: 86400 -} + css: 86400, +}; const CACHE_BLACKLIST = [ (str) => { - return !str.startsWith('http://localhost') - } -] + return !str.startsWith("http://localhost"); + }, +]; -const SUPPORTED_METHODS = [ - 'GET' -] +const SUPPORTED_METHODS = ["GET"]; /** * isBlackListed * @param {string} url * @returns {boolean} */ -function isBlacklisted (url) { - return (CACHE_BLACKLIST.length > 0) +function isBlacklisted(url) { + return CACHE_BLACKLIST.length > 0 ? !CACHE_BLACKLIST.filter((rule) => { - if (typeof rule === 'function') { - return !rule(url) + if (typeof rule === "function") { + return !rule(url); } else { - return false + return false; } }).length - : false + : false; } /** @@ -71,25 +69,25 @@ function isBlacklisted (url) { * @param {string} url * @returns {string} */ -function getFileExtension (url) { - const extension = url.split('.').reverse()[0].split('?')[0] - return (extension.endsWith('/')) ? '/' : extension +function getFileExtension(url) { + const extension = url.split(".").reverse()[0].split("?")[0]; + return extension.endsWith("/") ? "/" : extension; } /** * getTTL * @param {string} url */ -function getTTL (url) { - if (typeof url === 'string') { - const extension = getFileExtension(url) - if (typeof MAX_TTL[extension] === 'number') { - return MAX_TTL[extension] +function getTTL(url) { + if (typeof url === "string") { + const extension = getFileExtension(url); + if (typeof MAX_TTL[extension] === "number") { + return MAX_TTL[extension]; } else { - return null + return null; } } else { - return null + return null; } } @@ -97,230 +95,168 @@ function getTTL (url) { * installServiceWorker * @returns {Promise} */ -function installServiceWorker () { - return Promise.all( - [ - caches.open(CACHE_VERSIONS.assets) - .then( - (cache) => { - return cache.addAll(BASE_CACHE_FILES) - } - ), - caches.open(CACHE_VERSIONS.offline) - .then( - (cache) => { - return cache.addAll(OFFLINE_CACHE_FILES) - } - ), - caches.open(CACHE_VERSIONS.notFound) - .then( - (cache) => { - return cache.addAll(NOT_FOUND_CACHE_FILES) - } - ) - ] - ) - .then(() => { - return self.skipWaiting() - }) +function installServiceWorker() { + return Promise.all([ + caches.open(CACHE_VERSIONS.assets).then((cache) => { + return cache.addAll(BASE_CACHE_FILES); + }), + caches.open(CACHE_VERSIONS.offline).then((cache) => { + return cache.addAll(OFFLINE_CACHE_FILES); + }), + caches.open(CACHE_VERSIONS.notFound).then((cache) => { + return cache.addAll(NOT_FOUND_CACHE_FILES); + }), + ]).then(() => { + return self.skipWaiting(); + }); } /** * cleanupLegacyCache * @returns {Promise} */ -function cleanupLegacyCache () { - const currentCaches = Object.keys(CACHE_VERSIONS) - .map( - (key) => { - return CACHE_VERSIONS[key] - } - ) +function cleanupLegacyCache() { + const currentCaches = Object.keys(CACHE_VERSIONS).map((key) => { + return CACHE_VERSIONS[key]; + }); - return new Promise( - (resolve, reject) => { - caches.keys() - .then( - (keys) => { - return keys.filter( - (key) => { - return !~currentCaches.indexOf(key) - } - ) - } - ) - .then( - (legacy) => { - if (legacy.length) { - Promise.all( - legacy.map( - (legacyKey) => { - return caches.delete(legacyKey) - } - ) - ) - .then( - () => { - resolve() - } - ) - .catch( - (err) => { - reject(err) - } - ) - } else { - resolve() - } - } - ) - .catch( - (err) => { - reject(err) - } - ) - } - ) + return new Promise((resolve, reject) => { + caches + .keys() + .then((keys) => { + return keys.filter((key) => { + return !~currentCaches.indexOf(key); + }); + }) + .then((legacy) => { + if (legacy.length) { + Promise.all( + legacy.map((legacyKey) => { + return caches.delete(legacyKey); + }), + ) + .then(() => { + resolve(); + }) + .catch((err) => { + reject(err); + }); + } else { + resolve(); + } + }) + .catch((err) => { + reject(err); + }); + }); } -self.addEventListener( - 'install', event => { - event.waitUntil( - Promise.all([ - installServiceWorker(), - self.skipWaiting() - ]) - ) - } -) +self.addEventListener("install", (event) => { + event.waitUntil(Promise.all([installServiceWorker(), self.skipWaiting()])); +}); // The activate handler takes care of cleaning up old caches. -self.addEventListener( - 'activate', event => { - event.waitUntil( - Promise.all( - [ - cleanupLegacyCache(), - self.clients.claim(), - self.skipWaiting() - ] - ) - .catch( - (err) => { - console.log(err) - self.skipWaiting() - } - ) - ) - } -) +self.addEventListener("activate", (event) => { + event.waitUntil( + Promise.all([ + cleanupLegacyCache(), + self.clients.claim(), + self.skipWaiting(), + ]).catch((err) => { + console.log(err); + self.skipWaiting(); + }), + ); +}); -self.addEventListener( - 'fetch', event => { - event.respondWith( - caches.open(CACHE_VERSIONS.content) - .then( - (cache) => { - return cache.match(event.request) - .then( - (response) => { - if (response) { - const headers = response.headers.entries() - let date = null +self.addEventListener("fetch", (event) => { + event.respondWith( + caches.open(CACHE_VERSIONS.content).then((cache) => { + return cache + .match(event.request) + .then((response) => { + if (response) { + const headers = response.headers.entries(); + let date = null; - for (const pair of headers) { - if (pair[0] === 'date') { - date = new Date(pair[1]) - } - } - if (date) { - const age = parseInt((new Date().getTime() - date.getTime()) / 1000) - const ttl = getTTL(event.request.url) + for (const pair of headers) { + if (pair[0] === "date") { + date = new Date(pair[1]); + } + } + if (date) { + const age = parseInt( + (new Date().getTime() - date.getTime()) / 1000, + ); + const ttl = getTTL(event.request.url); - if (ttl && age > ttl) { - return new Promise( - (resolve) => { - return fetch(event.request.clone()) - .then( - (updatedResponse) => { - if (updatedResponse) { - cache.put(event.request, updatedResponse.clone()) - resolve(updatedResponse) - } else { - resolve(response) - } - } - ) - .catch( - () => { - resolve(response) - } - ) - } - ) - .catch( - (err) => { - console.log(err) - return response - } - ) + if (ttl && age > ttl) { + return new Promise((resolve) => { + return fetch(event.request.clone()) + .then((updatedResponse) => { + if (updatedResponse) { + cache.put(event.request, updatedResponse.clone()); + resolve(updatedResponse); } else { - return response + resolve(response); } - } else { - return response - } - } else { - return null - } - } - ) - .then( - (response) => { - if (response) { - return response - } else { - return fetch(event.request.clone()) - .then( - (response) => { - if (response.status < 400) { - if (~SUPPORTED_METHODS.indexOf(event.request.method) && !isBlacklisted(event.request.url) && event.request.url.slice(0, 4) === 'http') { - cache.put(event.request, response.clone()) - } - return response - } else { - return caches.open(CACHE_VERSIONS.notFound).then((cache) => { - return cache.match(NOT_FOUND_PAGE) - }) - } - } - ) - .then((response) => { - if (response) { - return response - } - }) - .catch( - () => { - return caches.open(CACHE_VERSIONS.offline) - .then( - (offlineCache) => { - return offlineCache.match(OFFLINE_PAGE) - } - ) - } - ) + }) + .catch(() => { + resolve(response); + }); + }).catch((err) => { + console.log(err); + return response; + }); + } else { + return response; + } + } else { + return response; + } + } else { + return null; + } + }) + .then((response) => { + if (response) { + return response; + } else { + return fetch(event.request.clone()) + .then((response) => { + if (response.status < 400) { + if ( + ~SUPPORTED_METHODS.indexOf(event.request.method) && + !isBlacklisted(event.request.url) && + event.request.url.slice(0, 4) === "http" + ) { + cache.put(event.request, response.clone()); } + return response; + } else { + return caches.open(CACHE_VERSIONS.notFound).then((cache) => { + return cache.match(NOT_FOUND_PAGE); + }); } - ) - .catch( - (error) => { - console.error(' Error in fetch handler:', error) - throw error + }) + .then((response) => { + if (response) { + return response; } - ) + }) + .catch(() => { + return caches + .open(CACHE_VERSIONS.offline) + .then((offlineCache) => { + return offlineCache.match(OFFLINE_PAGE); + }); + }); } - ) - ) - } -) + }) + .catch((error) => { + console.error(" Error in fetch handler:", error); + throw error; + }); + }), + ); +}); diff --git a/assets/js/theme.ts b/assets/js/theme.ts index b670e4e33..e43e2e512 100644 --- a/assets/js/theme.ts +++ b/assets/js/theme.ts @@ -2,573 +2,705 @@ export {}; // TODO: add more global states to the window object declare global { - interface Window { isDark: boolean; } + interface Window { + isDark: boolean; + } } - /* eslint-disable no-new */ /* eslint-disable no-undef */ -const Tablesort = require('tablesort') +const Tablesort = require("tablesort"); // const autocomplete = require('autocomplete.js') -function escape (unsafe) { - return unsafe.replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, ''') +function escape(unsafe) { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); } -function forEach (elements, handler) { - elements = elements || [] - for (let i = 0; i < elements.length; i++) handler(elements[i]) +function forEach(elements, handler) { + elements = elements || []; + for (let i = 0; i < elements.length; i++) handler(elements[i]); } -function getScrollTop () { - return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop +function getScrollTop() { + return ( + (document.documentElement && document.documentElement.scrollTop) || + document.body.scrollTop + ); } -function isMobileWindow () { - return window.matchMedia('only screen and (max-width: 680px)').matches +function isMobileWindow() { + return window.matchMedia("only screen and (max-width: 680px)").matches; } - /** * Initialize the mobile menu bar. */ -function initMenuMobile () { - const menuToggleMobile = document.getElementById('menu-toggle-mobile') - const menuMobile = document.getElementById('menu-mobile') +function initMenuMobile() { + const menuToggleMobile = document.getElementById("menu-toggle-mobile"); + const menuMobile = document.getElementById("menu-mobile"); // If no event listener has been registered yet, add one. if (!window.menuToggleMobileEventListener) { - menuToggleMobile.addEventListener('click', () => { - document.body.classList.toggle('blur') - menuToggleMobile.classList.toggle('active') - menuMobile.classList.toggle('active') - }) - window.menuToggleMobileEventListener = true + menuToggleMobile.addEventListener("click", () => { + document.body.classList.toggle("blur"); + menuToggleMobile.classList.toggle("active"); + menuMobile.classList.toggle("active"); + }); + window.menuToggleMobileEventListener = true; } // Remove the mask when click on it. window._menuMobileOnClickMask = () => { - menuToggleMobile.classList.remove('active') - menuMobile.classList.remove('active') - } - window.clickMaskEventSet.add(window._menuMobileOnClickMask) + menuToggleMobile.classList.remove("active"); + menuMobile.classList.remove("active"); + }; + window.clickMaskEventSet.add(window._menuMobileOnClickMask); } /** * Set the color theme * @param {string} theme */ -function setColorTheme (theme) { - window.setTheme(theme) - window.saveTheme(theme) +function setColorTheme(theme) { + window.setTheme(theme); + window.saveTheme(theme); } /** * Initialize the switch theme button. */ -function initSwitchTheme () { - Array.from(document.getElementsByClassName('theme-switch')).forEach(themeSwitch => { - themeSwitch.addEventListener('click', () => { - const currentTheme = document.body.getAttribute('theme') - if (currentTheme === 'dark') { - setColorTheme('light') - } else { - setColorTheme('dark') - } - for (const event of window.switchThemeEventSet) event() - }) - }) +function initSwitchTheme() { + Array.from(document.getElementsByClassName("theme-switch")).forEach( + (themeSwitch) => { + themeSwitch.addEventListener("click", () => { + const currentTheme = document.body.getAttribute("theme"); + if (currentTheme === "dark") { + setColorTheme("light"); + } else { + setColorTheme("dark"); + } + for (const event of window.switchThemeEventSet) event(); + }); + }, + ); } /** * Initialize the select theme button. */ -function initSelectTheme () { - Array.from(document.getElementsByClassName('color-theme-select')).forEach(themeSelect => { - // Get the current theme - const currentTheme = document.body.getAttribute('theme') - // Set the selected Index - for (let j = 0; j < themeSelect.options.length; j++) { - const i = themeSelect.options[j] - if (i.value === currentTheme) { - themeSelect.selectedIndex = j - break +function initSelectTheme() { + Array.from(document.getElementsByClassName("color-theme-select")).forEach( + (themeSelect) => { + // Get the current theme + const currentTheme = document.body.getAttribute("theme"); + // Set the selected Index + for (let j = 0; j < themeSelect.options.length; j++) { + const i = themeSelect.options[j]; + if (i.value === currentTheme) { + themeSelect.selectedIndex = j; + break; + } } - } - themeSelect.addEventListener('change', () => { - const theme = themeSelect.value - window.localStorage && localStorage.setItem('theme', theme) - if (theme !== 'auto') { - setColorTheme(theme) - } else { - if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { - setColorTheme('dark') + themeSelect.addEventListener("change", () => { + const theme = themeSelect.value; + window.localStorage && localStorage.setItem("theme", theme); + if (theme !== "auto") { + setColorTheme(theme); } else { - setColorTheme('light') + if ( + window.matchMedia && + window.matchMedia("(prefers-color-scheme: dark)").matches + ) { + setColorTheme("dark"); + } else { + setColorTheme("light"); + } } - } - for (const event of window.switchThemeEventSet) event() - }) - }) + for (const event of window.switchThemeEventSet) event(); + }); + }, + ); } /** * Initialize the search box. * @returns {null} */ -function initSearch () { - const searchConfig = window.config.search - const isMobile = window.matchMedia && window.matchMedia('only screen and (max-width: 680px)').matches +function initSearch() { + const searchConfig = window.config.search; + const isMobile = + window.matchMedia && + window.matchMedia("only screen and (max-width: 680px)").matches; // If there is no search config // Or the search has been initialized already // Return directly - if (!searchConfig || (isMobile && window._searchMobileOnce) || (!isMobile && window._searchDesktopOnce)) return + if ( + !searchConfig || + (isMobile && window._searchMobileOnce) || + (!isMobile && window._searchDesktopOnce) + ) + return; // Initialize default search config - const maxResultLength = searchConfig.maxResultLength ? searchConfig.maxResultLength : 10 - const snippetLength = searchConfig.snippetLength ? searchConfig.snippetLength : 50 - const highlightTag = searchConfig.highlightTag ? searchConfig.highlightTag : 'em' - const isCaseSensitive = searchConfig.isCaseSensitive ? searchConfig.isCaseSensitive : false - const minMatchCharLength = searchConfig.minMatchCharLength ? searchConfig.minMatchCharLength : 1 - const findAllMatches = searchConfig.findAllMatches ? searchConfig.findAllMatches : false - const location = searchConfig.location ? searchConfig.location : 0 - const threshold = searchConfig.threshold ? searchConfig.threshold : 0.3 - const distance = searchConfig.distance ? searchConfig.distance : 100 - const ignoreLocation = searchConfig.ignoreLocation ? searchConfig.ignoreLocation : false - const useExtendedSearch = searchConfig.useExtendedSearch ? searchConfig.useExtendedSearch : false - const ignoreFieldNorm = searchConfig.ignoreFieldNorm ? searchConfig.ignoreFieldNorm : false - const suffix = isMobile ? 'mobile' : 'desktop' - const header = document.getElementById(`header-${suffix}`) - const searchInput = document.getElementById(`search-input-${suffix}`) - const searchToggle = document.getElementById(`search-toggle-${suffix}`) - const searchLoading = document.getElementById(`search-loading-${suffix}`) - const searchClear = document.getElementById(`search-clear-${suffix}`) - const autocompleteJs = window.config['autocomplete.min.js'] - const algoliaJs = window.config['algoliasearch.min.js'] - const fuseJs = window.config['fuse.min.js'] + const maxResultLength = searchConfig.maxResultLength + ? searchConfig.maxResultLength + : 10; + const snippetLength = searchConfig.snippetLength + ? searchConfig.snippetLength + : 50; + const highlightTag = searchConfig.highlightTag + ? searchConfig.highlightTag + : "em"; + const isCaseSensitive = searchConfig.isCaseSensitive + ? searchConfig.isCaseSensitive + : false; + const minMatchCharLength = searchConfig.minMatchCharLength + ? searchConfig.minMatchCharLength + : 1; + const findAllMatches = searchConfig.findAllMatches + ? searchConfig.findAllMatches + : false; + const location = searchConfig.location ? searchConfig.location : 0; + const threshold = searchConfig.threshold ? searchConfig.threshold : 0.3; + const distance = searchConfig.distance ? searchConfig.distance : 100; + const ignoreLocation = searchConfig.ignoreLocation + ? searchConfig.ignoreLocation + : false; + const useExtendedSearch = searchConfig.useExtendedSearch + ? searchConfig.useExtendedSearch + : false; + const ignoreFieldNorm = searchConfig.ignoreFieldNorm + ? searchConfig.ignoreFieldNorm + : false; + const suffix = isMobile ? "mobile" : "desktop"; + const header = document.getElementById(`header-${suffix}`); + const searchInput = document.getElementById(`search-input-${suffix}`); + const searchToggle = document.getElementById(`search-toggle-${suffix}`); + const searchLoading = document.getElementById(`search-loading-${suffix}`); + const searchClear = document.getElementById(`search-clear-${suffix}`); + const autocompleteJs = window.config["autocomplete.min.js"]; + const algoliaJs = window.config["algoliasearch.min.js"]; + const fuseJs = window.config["fuse.min.js"]; if (isMobile) { - window._searchMobileOnce = true + window._searchMobileOnce = true; // Turn on the mask when clicking on the search button - searchInput.addEventListener('focus', () => { - loadScript('autocomplete-script', autocompleteJs, () => { + searchInput.addEventListener("focus", () => { + loadScript("autocomplete-script", autocompleteJs, () => { initAutosearch(); searchInput.focus(); - }) - if (window.config?.search?.type === 'algolia') { - loadScript('algolia-script', algoliaJs, null) + }); + if (window.config?.search?.type === "algolia") { + loadScript("algolia-script", algoliaJs, null); } else { - loadScript('fuse-script', fuseJs, null) + loadScript("fuse-script", fuseJs, null); } - document.body.classList.add('blur') - header.classList.add('open') - searchInput.focus() - }) + document.body.classList.add("blur"); + header.classList.add("open"); + searchInput.focus(); + }); // Turn off the everything when clicking on the cancel button - document.getElementById('search-cancel-mobile').addEventListener('click', () => { - header.classList.remove('open') - document.body.classList.remove('blur') - document.getElementById('menu-toggle-mobile').classList.remove('active') - document.getElementById('menu-mobile').classList.remove('active') - searchLoading.style.display = 'none' - searchClear.style.display = 'none' - window._searchMobile && window._searchMobile.autocomplete.setVal('') - }) + document + .getElementById("search-cancel-mobile") + .addEventListener("click", () => { + header.classList.remove("open"); + document.body.classList.remove("blur"); + document + .getElementById("menu-toggle-mobile") + .classList.remove("active"); + document.getElementById("menu-mobile").classList.remove("active"); + searchLoading.style.display = "none"; + searchClear.style.display = "none"; + window._searchMobile && window._searchMobile.autocomplete.setVal(""); + }); // Clear the search box when clicking on the clear button - searchClear.addEventListener('click', () => { - searchClear.style.display = 'none' - window._searchMobile && window._searchMobile.autocomplete.setVal('') - }, false) + searchClear.addEventListener( + "click", + () => { + searchClear.style.display = "none"; + window._searchMobile && window._searchMobile.autocomplete.setVal(""); + }, + false, + ); // Remove the mask when click on it window._searchMobileOnClickMask = () => { - header.classList.remove('open') - searchLoading.style.display = 'none' - searchClear.style.display = 'none' - window._searchMobile && window._searchMobile.autocomplete.setVal('') - } - window.clickMaskEventSet.add(window._searchMobileOnClickMask) + header.classList.remove("open"); + searchLoading.style.display = "none"; + searchClear.style.display = "none"; + window._searchMobile && window._searchMobile.autocomplete.setVal(""); + }; + window.clickMaskEventSet.add(window._searchMobileOnClickMask); } else { - window._searchDesktopOnce = true + window._searchDesktopOnce = true; // Turn on the mask when clicking on the search button - searchToggle.addEventListener('click', () => { - loadScript('autocomplete-script', autocompleteJs, () => { + searchToggle.addEventListener("click", () => { + loadScript("autocomplete-script", autocompleteJs, () => { initAutosearch(); searchInput.focus(); - }) - if (window.config?.search?.type === 'algolia') { - loadScript('algolia-script', algoliaJs, null) + }); + if (window.config?.search?.type === "algolia") { + loadScript("algolia-script", algoliaJs, null); } else { - loadScript('fuse-script', fuseJs, null) + loadScript("fuse-script", fuseJs, null); } - document.body.classList.add('blur') - header.classList.add('open') - searchInput.focus() - }) + document.body.classList.add("blur"); + header.classList.add("open"); + searchInput.focus(); + }); // Clear the search box when clicking on the clear button - searchClear.addEventListener('click', () => { - searchClear.style.display = 'none' - window._searchDesktop && window._searchDesktop.autocomplete.setVal('') - }) + searchClear.addEventListener("click", () => { + searchClear.style.display = "none"; + window._searchDesktop && window._searchDesktop.autocomplete.setVal(""); + }); // Toggle search when Ctrl + K is pressed - document.addEventListener('keydown', e => { - if (e.ctrlKey && e.code === 'KeyK') { - e.preventDefault() - searchToggle.click() + document.addEventListener("keydown", (e) => { + if (e.ctrlKey && e.code === "KeyK") { + e.preventDefault(); + searchToggle.click(); } - }) + }); // Remove the mask when click on it window._searchDesktopOnClickMask = () => { - header.classList.remove('open') - searchLoading.style.display = 'none' - searchClear.style.display = 'none' - window._searchDesktop && window._searchDesktop.autocomplete.setVal('') - } - window.clickMaskEventSet.add(window._searchDesktopOnClickMask) + header.classList.remove("open"); + searchLoading.style.display = "none"; + searchClear.style.display = "none"; + window._searchDesktop && window._searchDesktop.autocomplete.setVal(""); + }; + window.clickMaskEventSet.add(window._searchDesktopOnClickMask); } // Display the clear button only when the search box is not empty - searchInput.addEventListener('input', () => { - if (searchInput.value === '') searchClear.style.display = 'none' - else searchClear.style.display = 'inline' - }) + searchInput.addEventListener("input", () => { + if (searchInput.value === "") searchClear.style.display = "none"; + else searchClear.style.display = "inline"; + }); const initAutosearch = () => { - const autosearch = autocomplete(`#search-input-${suffix}`, { - hint: false, - autoselect: true, - dropdownMenuContainer: `#search-dropdown-${suffix}`, - clearOnSelected: false, - cssClasses: { noPrefix: true }, - debug: true - }, { - name: 'search', - source: (query, callback) => { - searchLoading.style.display = 'inline' - searchClear.style.display = 'none' - const finish = (results) => { - searchLoading.style.display = 'none' - searchClear.style.display = 'inline' - callback(results) - } - if (searchConfig.type === 'algolia') { - window._algoliaIndex = window._algoliaIndex || algoliasearch(searchConfig.algoliaAppID, searchConfig.algoliaSearchKey).initIndex(searchConfig.algoliaIndex) - window._algoliaIndex - .search(query, { - offset: 0, - length: maxResultLength * 8, - attributesToHighlight: ['title'], - attributesToRetrieve: ['*'], - attributesToSnippet: [`content:${snippetLength}`], - highlightPreTag: `<${highlightTag}>`, - highlightPostTag: `` - }) - .then(({ hits }) => { - const results = {} - hits.forEach(({ uri, date, _highlightResult: { title }, _snippetResult: { content } }) => { - if (results[uri] && results[uri].context.length > content.value) return - results[uri] = { - uri, - title: title.value, - date, - context: content.value - } + const autosearch = autocomplete( + `#search-input-${suffix}`, + { + hint: false, + autoselect: true, + dropdownMenuContainer: `#search-dropdown-${suffix}`, + clearOnSelected: false, + cssClasses: { noPrefix: true }, + debug: true, + }, + { + name: "search", + source: (query, callback) => { + searchLoading.style.display = "inline"; + searchClear.style.display = "none"; + const finish = (results) => { + searchLoading.style.display = "none"; + searchClear.style.display = "inline"; + callback(results); + }; + if (searchConfig.type === "algolia") { + window._algoliaIndex = + window._algoliaIndex || + algoliasearch( + searchConfig.algoliaAppID, + searchConfig.algoliaSearchKey, + ).initIndex(searchConfig.algoliaIndex); + window._algoliaIndex + .search(query, { + offset: 0, + length: maxResultLength * 8, + attributesToHighlight: ["title"], + attributesToRetrieve: ["*"], + attributesToSnippet: [`content:${snippetLength}`], + highlightPreTag: `<${highlightTag}>`, + highlightPostTag: ``, }) - finish(Object.values(results).slice(0, maxResultLength)) - }) - .catch(err => { - console.error(err) - finish([]) - }) - } else if (searchConfig.type === 'fuse') { - const search = () => { - const results = {} - window._index.search(query).forEach(({ item, refIndex, matches }) => { - let title = item.title - let content = item.content - matches.forEach(({ indices, value, key }) => { - if (key === 'content') { - let offset = 0 - for (let i = 0; i < indices.length; i++) { - const substr = content.substring(indices[i][0] + offset, indices[i][1] + 1 + offset) - const tag = `<${highlightTag}>` + substr + `` - content = content.substring(0, indices[i][0] + offset) + tag + content.substring(indices[i][1] + 1 + offset, content.length) - offset += highlightTag.length * 2 + 5 - } - } else if (key === 'title') { - let offset = 0 - for (let i = 0; i < indices.length; i++) { - const substr = title.substring(indices[i][0] + offset, indices[i][1] + 1 + offset) - const tag = `<${highlightTag}>` + substr + `` - title = title.substring(0, indices[i][0] + offset) + tag + title.substring(indices[i][1] + 1 + offset, content.length) - offset += highlightTag.length * 2 + 5 - } - } + .then(({ hits }) => { + const results = {}; + hits.forEach( + ({ + uri, + date, + _highlightResult: { title }, + _snippetResult: { content }, + }) => { + if ( + results[uri] && + results[uri].context.length > content.value + ) + return; + results[uri] = { + uri, + title: title.value, + date, + context: content.value, + }; + }, + ); + finish(Object.values(results).slice(0, maxResultLength)); }) - results[item.uri] = { - uri: item.uri, - title, - date: item.date, - context: content - } - }) - return Object.values(results).slice(0, maxResultLength) + .catch((err) => { + console.error(err); + finish([]); + }); + } else if (searchConfig.type === "fuse") { + const search = () => { + const results = {}; + window._index + .search(query) + .forEach(({ item, refIndex, matches }) => { + let title = item.title; + let content = item.content; + matches.forEach(({ indices, value, key }) => { + if (key === "content") { + let offset = 0; + for (let i = 0; i < indices.length; i++) { + const substr = content.substring( + indices[i][0] + offset, + indices[i][1] + 1 + offset, + ); + const tag = + `<${highlightTag}>` + substr + ``; + content = + content.substring(0, indices[i][0] + offset) + + tag + + content.substring( + indices[i][1] + 1 + offset, + content.length, + ); + offset += highlightTag.length * 2 + 5; + } + } else if (key === "title") { + let offset = 0; + for (let i = 0; i < indices.length; i++) { + const substr = title.substring( + indices[i][0] + offset, + indices[i][1] + 1 + offset, + ); + const tag = + `<${highlightTag}>` + substr + ``; + title = + title.substring(0, indices[i][0] + offset) + + tag + + title.substring( + indices[i][1] + 1 + offset, + content.length, + ); + offset += highlightTag.length * 2 + 5; + } + } + }); + results[item.uri] = { + uri: item.uri, + title, + date: item.date, + context: content, + }; + }); + return Object.values(results).slice(0, maxResultLength); + }; + if (!window._index) { + fetch(searchConfig.fuseIndexURL) + .then((response) => response.json()) + .then((data) => { + const options = { + isCaseSensitive, + findAllMatches, + minMatchCharLength, + location, + threshold, + distance, + ignoreLocation, + useExtendedSearch, + ignoreFieldNorm, + includeScore: false, + shouldSort: true, + includeMatches: true, + keys: ["content", "title"], + }; + window._index = new Fuse(data, options); + finish(search()); + }) + .catch((err) => { + console.error(err); + finish([]); + }); + } else finish(search()); } - if (!window._index) { - fetch(searchConfig.fuseIndexURL) - .then(response => response.json()) - .then(data => { - const options = { - isCaseSensitive, - findAllMatches, - minMatchCharLength, - location, - threshold, - distance, - ignoreLocation, - useExtendedSearch, - ignoreFieldNorm, - includeScore: false, - shouldSort: true, - includeMatches: true, - keys: [ - 'content', - 'title' - ] - } - window._index = new Fuse(data, options) - finish(search()) - }).catch(err => { - console.error(err) - finish([]) - }) - } else finish(search()) - } + }, + templates: { + suggestion: ({ title, uri, date, context }) => + `
${title}${date}
${context}
`, + empty: ({ query }) => + `
${searchConfig.noResultsFound}: "${escape(query)}"
`, + footer: () => { + const { searchType, icon, href } = + searchConfig.type === "algolia" + ? { + searchType: "algolia", + icon: '', + href: "https://www.algolia.com/", + } + : { + searchType: "Fuse.js", + icon: "", + href: "https://fusejs.io/", + }; + return ``; + }, + }, }, - templates: { - suggestion: ({ title, uri, date, context }) => `
${title}${date}
${(context)}
`, - empty: ({ query }) => `
${searchConfig.noResultsFound}: "${escape(query)}"
`, - footer: () => { - const { searchType, icon, href } = searchConfig.type === 'algolia' - ? { - searchType: 'algolia', - icon: '', - href: 'https://www.algolia.com/' - } - : { - searchType: 'Fuse.js', - icon: '', - href: 'https://fusejs.io/' - } - return `` - } - } - }) - autosearch.on('autocomplete:selected', (event, _suggestion, _dataset, _context) => { - event.preventDefault(); - }) - if (isMobile) window._searchMobile = autosearch - else window._searchDesktop = autosearch - } - function loadScript (id, url, onload) { + ); + autosearch.on( + "autocomplete:selected", + (event, _suggestion, _dataset, _context) => { + event.preventDefault(); + }, + ); + if (isMobile) window._searchMobile = autosearch; + else window._searchDesktop = autosearch; + }; + function loadScript(id, url, onload) { if (document.querySelector(`#${id}`) === null) { - const head = document.querySelector('head') - const script = document.createElement('script') - script.setAttribute('src', url) - script.setAttribute('id', id) - script.onload = onload - head.appendChild(script) + const head = document.querySelector("head"); + const script = document.createElement("script"); + script.setAttribute("src", url); + script.setAttribute("id", id); + script.onload = onload; + head.appendChild(script); } } } -function initDetails () { - document.querySelectorAll('.details').forEach($details => { - const $summary = $details.getElementsByClassName('details-summary')[0] as HTMLDivElement - const content = $summary.nextElementSibling as HTMLDivElement - if ($details.classList.contains('open')) { - content.style.maxHeight = content.scrollHeight + 'px' +function initDetails() { + document.querySelectorAll(".details").forEach(($details) => { + const $summary = $details.getElementsByClassName( + "details-summary", + )[0] as HTMLDivElement; + const content = $summary.nextElementSibling as HTMLDivElement; + if ($details.classList.contains("open")) { + content.style.maxHeight = content.scrollHeight + "px"; } - $summary.addEventListener('click', () => { - if ($details.classList.contains('open')) { - content.style.maxHeight = "0px" - } else { - content.style.maxHeight = content.scrollHeight + 'px' - } - $details.classList.toggle('open') - }, false) + $summary.addEventListener( + "click", + () => { + if ($details.classList.contains("open")) { + content.style.maxHeight = "0px"; + } else { + content.style.maxHeight = content.scrollHeight + "px"; + } + $details.classList.toggle("open"); + }, + false, + ); addEventListener("beforeprint", () => { - if ($details.classList.contains('open')) { + if ($details.classList.contains("open")) { return; } $summary.click(); }); - }) + }); } -function initLightGallery () { +function initLightGallery() { if (window.config.lightGallery) { - lightGallery(document.getElementById('content'), window.config.lightGallery) + lightGallery( + document.getElementById("content"), + window.config.lightGallery, + ); } } -function initTable () { - forEach(document.querySelectorAll('.content table'), $table => { - const $wrapper = document.createElement('div') - $wrapper.className = 'table-wrapper' - $table.parentElement.replaceChild($wrapper, $table) - $wrapper.appendChild($table) +function initTable() { + forEach(document.querySelectorAll(".content table"), ($table) => { + const $wrapper = document.createElement("div"); + $wrapper.className = "table-wrapper"; + $table.parentElement.replaceChild($wrapper, $table); + $wrapper.appendChild($table); if (window.config?.table?.sort) { - new Tablesort($table) + new Tablesort($table); } - }) + }); } -function initToc () { - const tocCore = document.getElementById('TableOfContents') +function initToc() { + const tocCore = document.getElementById("TableOfContents"); // Return directly if no toc - if (tocCore === null) return - const isTocStatic = window.matchMedia && window.matchMedia('only screen and (max-width: 1000px)').matches - - if (document.getElementById('toc-static').getAttribute('kept') || isTocStatic) { - if (window._tocOnScroll) window.scrollEventSet.delete(window._tocOnScroll) + if (tocCore === null) return; + const isTocStatic = + window.matchMedia && + window.matchMedia("only screen and (max-width: 1000px)").matches; + + if ( + document.getElementById("toc-static").getAttribute("kept") || + isTocStatic + ) { + if (window._tocOnScroll) window.scrollEventSet.delete(window._tocOnScroll); } else { - const toc = document.getElementById('toc-auto') - const tocLinkElements = tocCore.querySelectorAll('a:first-child') - const tocLiElements = tocCore.getElementsByTagName('li') - const headerLinkElements = document.getElementsByClassName('headerLink') - const headerIsFixed = document.body.getAttribute('header-desktop') !== 'normal' - const headerHeight = document.getElementById('header-desktop').offsetHeight - const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0) - const minTocTop = toc.offsetTop - const minScrollTop = minTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight) - window._tocOnScroll = window._tocOnScroll || (() => { - const footerTop = document.getElementById('post-footer').offsetTop - const maxTocTop = footerTop - toc.getBoundingClientRect().height - const maxScrollTop = maxTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight) - if (window.newScrollTop < minScrollTop) { - // If scroll to the top of the page - // Set toc to absolute - toc.style.position = 'absolute' - toc.style.top = `${minTocTop}px` - } else if (window.newScrollTop > maxScrollTop) { - // If scroll to the bottom of the page - // Set toc to absolute - toc.style.position = 'absolute' - toc.style.top = `${maxTocTop}px` - } else { - // If in the middle - // Set toc to fixed with TOP_SPACING - toc.style.position = 'fixed' - toc.style.top = `${TOP_SPACING}px` - } - // Update the active toc link - // Return directly if no toc link - if (tocLinkElements.length === 0) return - - let activeTocIndex = -1 - const INDEX_SPACING = TOP_SPACING + window.newScrollTop - // If the INDEX_SPACING is below the last header link - // activate the last element - if (headerLinkElements[headerLinkElements.length - 1].offsetTop < INDEX_SPACING) { - activeTocIndex = headerLinkElements.length - 1 - } else { - // Otherwise activate the element that is in between - // Use offsetTop instead of getBoundingClientRect().top for better performance - for (let i = 0; i < headerLinkElements.length - 1; i++) { - const thisTop = headerLinkElements[i].offsetTop - const nextTop = headerLinkElements[i + 1].offsetTop - if (thisTop <= INDEX_SPACING && nextTop > INDEX_SPACING) { - activeTocIndex = i - break + const toc = document.getElementById("toc-auto"); + const tocLinkElements = tocCore.querySelectorAll("a:first-child"); + const tocLiElements = tocCore.getElementsByTagName("li"); + const headerLinkElements = document.getElementsByClassName("headerLink"); + const headerIsFixed = + document.body.getAttribute("header-desktop") !== "normal"; + const headerHeight = document.getElementById("header-desktop").offsetHeight; + const TOP_SPACING = 20 + (headerIsFixed ? headerHeight : 0); + const minTocTop = toc.offsetTop; + const minScrollTop = + minTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight); + window._tocOnScroll = + window._tocOnScroll || + (() => { + const footerTop = document.getElementById("post-footer").offsetTop; + const maxTocTop = footerTop - toc.getBoundingClientRect().height; + const maxScrollTop = + maxTocTop - TOP_SPACING + (headerIsFixed ? 0 : headerHeight); + if (window.newScrollTop < minScrollTop) { + // If scroll to the top of the page + // Set toc to absolute + toc.style.position = "absolute"; + toc.style.top = `${minTocTop}px`; + } else if (window.newScrollTop > maxScrollTop) { + // If scroll to the bottom of the page + // Set toc to absolute + toc.style.position = "absolute"; + toc.style.top = `${maxTocTop}px`; + } else { + // If in the middle + // Set toc to fixed with TOP_SPACING + toc.style.position = "fixed"; + toc.style.top = `${TOP_SPACING}px`; + } + // Update the active toc link + // Return directly if no toc link + if (tocLinkElements.length === 0) return; + + let activeTocIndex = -1; + const INDEX_SPACING = TOP_SPACING + window.newScrollTop; + // If the INDEX_SPACING is below the last header link + // activate the last element + if ( + headerLinkElements[headerLinkElements.length - 1].offsetTop < + INDEX_SPACING + ) { + activeTocIndex = headerLinkElements.length - 1; + } else { + // Otherwise activate the element that is in between + // Use offsetTop instead of getBoundingClientRect().top for better performance + for (let i = 0; i < headerLinkElements.length - 1; i++) { + const thisTop = headerLinkElements[i].offsetTop; + const nextTop = headerLinkElements[i + 1].offsetTop; + if (thisTop <= INDEX_SPACING && nextTop > INDEX_SPACING) { + activeTocIndex = i; + break; + } } } - } - // Remove all legacy states - Array.from(tocLinkElements).forEach(tocLink => tocLink.classList.remove('active')) - Array.from(tocLiElements).forEach(tocLi => tocLi.classList.remove('has-active')) - - // Set the tocLinkElement to active - // and all its parent to has-active - if (activeTocIndex >= 0 && activeTocIndex < tocLinkElements.length) { - tocLinkElements[activeTocIndex].classList.add('active') - // tocLinkElements[activeTocIndex].scrollIntoView({ - // behavior: 'smooth', - // block: 'center' - // }) - let parent = tocLinkElements[activeTocIndex].parentElement - while (parent !== tocCore) { - parent.classList.add('has-active') - parent = parent.parentElement.parentElement + // Remove all legacy states + Array.from(tocLinkElements).forEach((tocLink) => + tocLink.classList.remove("active"), + ); + Array.from(tocLiElements).forEach((tocLi) => + tocLi.classList.remove("has-active"), + ); + + // Set the tocLinkElement to active + // and all its parent to has-active + if (activeTocIndex >= 0 && activeTocIndex < tocLinkElements.length) { + tocLinkElements[activeTocIndex].classList.add("active"); + // tocLinkElements[activeTocIndex].scrollIntoView({ + // behavior: 'smooth', + // block: 'center' + // }) + let parent = tocLinkElements[activeTocIndex].parentElement; + while (parent !== tocCore) { + parent.classList.add("has-active"); + parent = parent.parentElement.parentElement; + } } - } - }) - window._tocOnScroll() - window.scrollEventSet.add(window._tocOnScroll) + }); + window._tocOnScroll(); + window.scrollEventSet.add(window._tocOnScroll); } } -function initMapbox () { +function initMapbox() { if (window.config.mapbox) { - mapboxgl.accessToken = window.config.mapbox.accessToken - mapboxgl.setRTLTextPlugin(window.config.mapbox.RTLTextPlugin) - window._mapboxArr = window._mapboxArr || [] - forEach(document.getElementsByClassName('mapbox'), $mapbox => { - const { lng, lat, zoom, lightStyle, darkStyle, marked, navigation, geolocate, scale, fullscreen } = window.config.data[$mapbox.id] + mapboxgl.accessToken = window.config.mapbox.accessToken; + mapboxgl.setRTLTextPlugin(window.config.mapbox.RTLTextPlugin); + window._mapboxArr = window._mapboxArr || []; + forEach(document.getElementsByClassName("mapbox"), ($mapbox) => { + const { + lng, + lat, + zoom, + lightStyle, + darkStyle, + marked, + navigation, + geolocate, + scale, + fullscreen, + } = window.config.data[$mapbox.id]; const mapbox = new mapboxgl.Map({ container: $mapbox, center: [lng, lat], zoom, minZoom: 0.2, style: window.isDark ? darkStyle : lightStyle, - attributionControl: false - }) + attributionControl: false, + }); if (marked) { - new mapboxgl.Marker().setLngLat([lng, lat]).addTo(mapbox) + new mapboxgl.Marker().setLngLat([lng, lat]).addTo(mapbox); } if (navigation) { - mapbox.addControl(new mapboxgl.NavigationControl(), 'bottom-right') + mapbox.addControl(new mapboxgl.NavigationControl(), "bottom-right"); } if (geolocate) { - mapbox.addControl(new mapboxgl.GeolocateControl({ - positionOptions: { - enableHighAccuracy: true - }, - showUserLocation: true, - trackUserLocation: true - }), 'bottom-right') + mapbox.addControl( + new mapboxgl.GeolocateControl({ + positionOptions: { + enableHighAccuracy: true, + }, + showUserLocation: true, + trackUserLocation: true, + }), + "bottom-right", + ); } if (scale) { - mapbox.addControl(new mapboxgl.ScaleControl()) + mapbox.addControl(new mapboxgl.ScaleControl()); } if (fullscreen) { - mapbox.addControl(new mapboxgl.FullscreenControl()) + mapbox.addControl(new mapboxgl.FullscreenControl()); } - mapbox.addControl(new MapboxLanguage()) - window._mapboxArr.push(mapbox) - }) + mapbox.addControl(new MapboxLanguage()); + window._mapboxArr.push(mapbox); + }); window._mapboxOnSwitchTheme = () => { - forEach(window._mapboxArr, mapbox => { - const $mapbox = mapbox.getContainer() - const { lightStyle, darkStyle } = window.config.data[$mapbox.id] - mapbox.setStyle(window.isDark ? darkStyle : lightStyle) - mapbox.addControl(new MapboxLanguage()) - }) - } - window.switchThemeEventSet.add(window._mapboxOnSwitchTheme) + forEach(window._mapboxArr, (mapbox) => { + const $mapbox = mapbox.getContainer(); + const { lightStyle, darkStyle } = window.config.data[$mapbox.id]; + mapbox.setStyle(window.isDark ? darkStyle : lightStyle); + mapbox.addControl(new MapboxLanguage()); + }); + }; + window.switchThemeEventSet.add(window._mapboxOnSwitchTheme); } } -function initTypeit () { +function initTypeit() { if (window.config.typeit) { - const typeitConfig = window.config.typeit - const speed = typeitConfig.speed ? typeitConfig.speed : 100 - const cursorSpeed = typeitConfig.cursorSpeed ? typeitConfig.cursorSpeed : 1000 - const cursorChar = typeitConfig.cursorChar ? typeitConfig.cursorChar : '|' - Object.values(typeitConfig.data).forEach(group => { + const typeitConfig = window.config.typeit; + const speed = typeitConfig.speed ? typeitConfig.speed : 100; + const cursorSpeed = typeitConfig.cursorSpeed + ? typeitConfig.cursorSpeed + : 1000; + const cursorChar = typeitConfig.cursorChar ? typeitConfig.cursorChar : "|"; + Object.values(typeitConfig.data).forEach((group) => { const typeone = (i) => { - const id = group[i] - if (!document.getElementById(id).hasAttribute('data-typeit-id')) { + const id = group[i]; + if (!document.getElementById(id).hasAttribute("data-typeit-id")) { const instance = new TypeIt(`#${id}`, { strings: window.config.data[id], speed, @@ -580,154 +712,173 @@ function initTypeit () { if (i === group.length - 1) { if (typeitConfig.duration >= 0) { window.setTimeout(() => { - instance.destroy() - }, typeitConfig.duration) + instance.destroy(); + }, typeitConfig.duration); } - return + return; } - instance.destroy() - typeone(i + 1) - } - }).go() + instance.destroy(); + typeone(i + 1); + }, + }).go(); } - } - typeone(0) - }) + }; + typeone(0); + }); } } -function initMeta () { - function getMeta (metaName) { - const metas = document.getElementsByTagName('meta') +function initMeta() { + function getMeta(metaName) { + const metas = document.getElementsByTagName("meta"); for (let i = 0; i < metas.length; i++) { - if (metas[i].getAttribute('name') === metaName) { - return metas[i] + if (metas[i].getAttribute("name") === metaName) { + return metas[i]; } } } - const themeColorMeta = getMeta('theme-color') + const themeColorMeta = getMeta("theme-color"); const metaColors = { - light: '#f8f8f8', - dark: '#161b22' - } + light: "#f8f8f8", + dark: "#161b22", + }; window._metaThemeColorOnSwitchTheme = () => { - themeColorMeta.content = metaColors[document.body.getAttribute('theme')] - } - window.switchThemeEventSet.add(window._metaThemeColorOnSwitchTheme) - window._metaThemeColorOnSwitchTheme() + themeColorMeta.content = metaColors[document.body.getAttribute("theme")]; + }; + window.switchThemeEventSet.add(window._metaThemeColorOnSwitchTheme); + window._metaThemeColorOnSwitchTheme(); } -function onScroll () { - const backToTop = document.getElementById("back-to-top-button") - function handleScrollEvent () { - window.newScrollTop = getScrollTop() +function onScroll() { + const backToTop = document.getElementById("back-to-top-button"); + function handleScrollEvent() { + window.newScrollTop = getScrollTop(); if (window.newScrollTop > 20) { - backToTop.style.opacity = '1' + backToTop.style.opacity = "1"; } else { - backToTop.style.opacity = '0' + backToTop.style.opacity = "0"; } - for (const event of window.scrollEventSet) event() - window.oldScrollTop = window.newScrollTop + for (const event of window.scrollEventSet) event(); + window.oldScrollTop = window.newScrollTop; } - window.addEventListener('scroll', handleScrollEvent, false) + window.addEventListener("scroll", handleScrollEvent, false); } -function onResize () { - window.addEventListener('resize', () => { - if (!window._resizeTimeout) { - window._resizeTimeout = window.setTimeout(() => { - window._resizeTimeout = null - for (const event of window.resizeEventSet) event() - initSearch() - }, 100) - } - }, false) +function onResize() { + window.addEventListener( + "resize", + () => { + if (!window._resizeTimeout) { + window._resizeTimeout = window.setTimeout(() => { + window._resizeTimeout = null; + for (const event of window.resizeEventSet) event(); + initSearch(); + }, 100); + } + }, + false, + ); } -function onClickMask () { - document.getElementById('mask').addEventListener('click', () => { - for (const event of window.clickMaskEventSet) event() - document.body.classList.remove('blur') - }, false) +function onClickMask() { + document.getElementById("mask").addEventListener( + "click", + () => { + for (const event of window.clickMaskEventSet) event(); + document.body.classList.remove("blur"); + }, + false, + ); } function initCodeblocks() { - document.querySelectorAll('.code-block').forEach((codeBlock) => { + document.querySelectorAll(".code-block").forEach((codeBlock) => { // the queries are guaranteed to be successful - const titleBar = codeBlock.querySelector('div.code-block-title-bar') as HTMLDivElement; - const chroma = codeBlock.querySelector('code.chroma') as HTMLElement; - const copyCodeButton = codeBlock.querySelector('button.copy-code-button') as HTMLButtonElement; - const copyIcon = copyCodeButton.querySelector('span.copy-icon') as SVGElement; - const checkIcon = copyCodeButton.querySelector('span.check-icon') as SVGElement; - const wrapCodeButton = codeBlock.querySelector('button.wrap-code-button') as HTMLButtonElement; - const toggleLineNumbersButton = codeBlock.querySelector('button.line-number-button') as HTMLButtonElement; - - chroma.style.maxHeight = chroma.scrollHeight + 10 + 'px'; + const titleBar = codeBlock.querySelector( + "div.code-block-title-bar", + ) as HTMLDivElement; + const chroma = codeBlock.querySelector("code.chroma") as HTMLElement; + const copyCodeButton = codeBlock.querySelector( + "button.copy-code-button", + ) as HTMLButtonElement; + const copyIcon = copyCodeButton.querySelector( + "span.copy-icon", + ) as SVGElement; + const checkIcon = copyCodeButton.querySelector( + "span.check-icon", + ) as SVGElement; + const wrapCodeButton = codeBlock.querySelector( + "button.wrap-code-button", + ) as HTMLButtonElement; + const toggleLineNumbersButton = codeBlock.querySelector( + "button.line-number-button", + ) as HTMLButtonElement; + + chroma.style.maxHeight = chroma.scrollHeight + 10 + "px"; // handle expanding and collapsing code blocks - titleBar.addEventListener('click', () => { - codeBlock.classList.toggle('is-open'); - codeBlock.classList.toggle('is-closed'); + titleBar.addEventListener("click", () => { + codeBlock.classList.toggle("is-open"); + codeBlock.classList.toggle("is-closed"); }); // handle copying code to clipboard - copyCodeButton?.addEventListener('click', () => { + copyCodeButton?.addEventListener("click", () => { navigator.clipboard.writeText(chroma.innerText); // toggle icons - copyIcon.style.display = 'none'; - checkIcon.style.display = 'block'; + copyIcon.style.display = "none"; + checkIcon.style.display = "block"; setTimeout(() => { - copyIcon.style.display = 'block'; - checkIcon.style.display = 'none'; + copyIcon.style.display = "block"; + checkIcon.style.display = "none"; }, 3000); }); // handle wrapping lines in code blocks - wrapCodeButton?.addEventListener('click', () => { - chroma.style.maxHeight = 'fit-content'; - codeBlock.classList.toggle('is-wrap'); - chroma.style.maxHeight = chroma.scrollHeight + 10 + 'px'; + wrapCodeButton?.addEventListener("click", () => { + chroma.style.maxHeight = "fit-content"; + codeBlock.classList.toggle("is-wrap"); + chroma.style.maxHeight = chroma.scrollHeight + 10 + "px"; }); - toggleLineNumbersButton.addEventListener('click', () => { - codeBlock.classList.toggle('show-line-numbers'); + toggleLineNumbersButton.addEventListener("click", () => { + codeBlock.classList.toggle("show-line-numbers"); }); addEventListener("beforeprint", (_) => { - if (codeBlock.classList.contains('is-closed')) { + if (codeBlock.classList.contains("is-closed")) { titleBar.click(); } - if (!codeBlock.classList.contains('is-wrap')) { + if (!codeBlock.classList.contains("is-wrap")) { wrapCodeButton.click(); } }); }); -} - - -function init () { - window.isDark = document.body.getAttribute('theme') !== 'light' - window.newScrollTop = getScrollTop() - window.oldScrollTop = window.newScrollTop - window.scrollEventSet = new Set() - window.resizeEventSet = new Set() - window.clickMaskEventSet = new Set() - if (window.objectFitImages) objectFitImages() - initMenuMobile() - initSwitchTheme() - initSelectTheme() - initMeta() - initSearch() - initCodeblocks() - initDetails() - initLightGallery() - initTable() - initTypeit() - initMapbox() - initToc() - onScroll() - onResize() - onClickMask() } -init() +function init() { + window.isDark = document.body.getAttribute("theme") !== "light"; + window.newScrollTop = getScrollTop(); + window.oldScrollTop = window.newScrollTop; + window.scrollEventSet = new Set(); + window.resizeEventSet = new Set(); + window.clickMaskEventSet = new Set(); + if (window.objectFitImages) objectFitImages(); + initMenuMobile(); + initSwitchTheme(); + initSelectTheme(); + initMeta(); + initSearch(); + initCodeblocks(); + initDetails(); + initLightGallery(); + initTable(); + initTypeit(); + initMapbox(); + initToc(); + onScroll(); + onResize(); + onClickMask(); +} + +init(); diff --git a/dependencies.json b/dependencies.json index 8ac5d6cd3..1516e90dc 100644 --- a/dependencies.json +++ b/dependencies.json @@ -1,135 +1,135 @@ { - "localBasePath": "./assets/lib", - "dependencies": [ - { - "name": "twikoo", - "version": "1.6.34", - "files": [ - { - "remote": "dist/twikoo.all.min.js", - "local": "twikoo/twikoo.all.min.js" - }, - { - "remote": "dist/twikoo.min.js", - "local": "twikoo/twikoo.min.js" - } - ] + "localBasePath": "./assets/lib", + "dependencies": [ + { + "name": "twikoo", + "version": "1.6.34", + "files": [ + { + "remote": "dist/twikoo.all.min.js", + "local": "twikoo/twikoo.all.min.js" }, { - "name": "@waline/client", - "version": "3.2.0", - "files": [ - { - "remote": "dist/waline.css", - "local": "waline/waline.css" - }, - { - "remote": "dist/waline.umd.min.js", - "local": "waline/waline.js" - } - ] + "remote": "dist/twikoo.min.js", + "local": "twikoo/twikoo.min.js" + } + ] + }, + { + "name": "@waline/client", + "version": "3.2.0", + "files": [ + { + "remote": "dist/waline.css", + "local": "waline/waline.css" }, { - "name": "katex", - "version": "0.16.10", - "files": [ - { - "remote": "dist/katex.min.js", - "local": "katex/katex.min.js" - }, - { - "remote": "dist/katex.min.css", - "local": "katex/katex.min.css" - }, - { - "remote": "dist/contrib/auto-render.min.js", - "local": "katex/auto-render.min.js" - }, - { - "remote": "dist/contrib/copy-tex.min.js", - "local": "katex/copy-tex.min.js" - }, - { - "remote": "dist/contrib/mhchem.min.js", - "local": "katex/mhchem.min.js" - } - ] + "remote": "dist/waline.umd.min.js", + "local": "waline/waline.js" + } + ] + }, + { + "name": "katex", + "version": "0.16.10", + "files": [ + { + "remote": "dist/katex.min.js", + "local": "katex/katex.min.js" }, { - "name": "echarts", - "version": "5.5.0", - "files": [ - { - "remote": "dist/echarts.min.js", - "local": "echarts/echarts.min.js" - }, - { - "remote": "theme/macarons.min.js", - "local": "echarts/macarons.min.js" - } - ] + "remote": "dist/katex.min.css", + "local": "katex/katex.min.css" }, { - "name": "artalk", - "version": "2.8.6", - "files": [ - { - "remote": "dist/Artalk.js", - "local": "artalk/Artalk.js" - }, - { - "remote": "dist/Artalk.css", - "local": "artalk/Artalk.css" - }, - { - "remote": "dist/ArtalkLite.js", - "local": "artalk/ArtalkLite.js" - }, - { - "remote": "dist/ArtalkLite.css", - "local": "artalk/ArtalkLite.css" - } - ] + "remote": "dist/contrib/auto-render.min.js", + "local": "katex/auto-render.min.js" }, { - "name": "@artalk/plugin-katex", - "version": "0.1.6", - "files": [ - { - "remote": "dist/artalk-plugin-katex.js", - "local": "artalk/artalk-plugin-katex.js" - } - ] + "remote": "dist/contrib/copy-tex.min.js", + "local": "katex/copy-tex.min.js" }, { - "name": "@artalk/plugin-lightbox", - "version": "0.1.2", - "files": [ - { - "remote": "dist/artalk-plugin-lightbox.js", - "local": "artalk/artalk-plugin-lightbox.js" - } - ] + "remote": "dist/contrib/mhchem.min.js", + "local": "katex/mhchem.min.js" + } + ] + }, + { + "name": "echarts", + "version": "5.5.0", + "files": [ + { + "remote": "dist/echarts.min.js", + "local": "echarts/echarts.min.js" + }, + { + "remote": "theme/macarons.min.js", + "local": "echarts/macarons.min.js" + } + ] + }, + { + "name": "artalk", + "version": "2.8.6", + "files": [ + { + "remote": "dist/Artalk.js", + "local": "artalk/Artalk.js" }, { - "name": "instant.page", - "version": "5.2.0", - "files": [ - { - "remote": "instantpage.min.js", - "local": "instant.page/instantpage.min.js" - } - ] + "remote": "dist/Artalk.css", + "local": "artalk/Artalk.css" }, { - "name": "typeit", - "version": "8.8.3", - "files": [ - { - "remote": "dist/index.umd.min.js", - "local": "typeit/typeit.min.js" - } - ] + "remote": "dist/ArtalkLite.js", + "local": "artalk/ArtalkLite.js" + }, + { + "remote": "dist/ArtalkLite.css", + "local": "artalk/ArtalkLite.css" + } + ] + }, + { + "name": "@artalk/plugin-katex", + "version": "0.1.6", + "files": [ + { + "remote": "dist/artalk-plugin-katex.js", + "local": "artalk/artalk-plugin-katex.js" + } + ] + }, + { + "name": "@artalk/plugin-lightbox", + "version": "0.1.2", + "files": [ + { + "remote": "dist/artalk-plugin-lightbox.js", + "local": "artalk/artalk-plugin-lightbox.js" + } + ] + }, + { + "name": "instant.page", + "version": "5.2.0", + "files": [ + { + "remote": "instantpage.min.js", + "local": "instant.page/instantpage.min.js" + } + ] + }, + { + "name": "typeit", + "version": "8.8.3", + "files": [ + { + "remote": "dist/index.umd.min.js", + "local": "typeit/typeit.min.js" } - ] -} \ No newline at end of file + ] + } + ] +} diff --git a/exampleSite/schema.json b/exampleSite/schema.json index e4cce88c7..1881b6cc4 100644 --- a/exampleSite/schema.json +++ b/exampleSite/schema.json @@ -1,37 +1,30 @@ { - "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://hugodoit.pages.dev/schema.json", - "title": "Hugo DoIt theme configuration", - "description": "The configuration for the Hugo DoIt theme", - "type": "object", - "properties": { - "baseURL": { - "type": "string", - "description": "Hostname (and path) to the root.", - "examples": [ - "https://hugodoit.pages.dev" - ] - }, - "defaultContentLanguage": { - "type": "string", - "description": "Content without language indicator will default to this language.", - "examples": [ - "en", - "zh-cn", - "fr", - "pl" - ], - "default": "en" - }, - "theme": { - "type": ["string", "array"], - "default": "DoIt", - "minItems": 1, - "pattern": "^DoIt$", - "contains": { - "pattern": "^DoIt$" - } - } + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "http://hugodoit.pages.dev/schema.json", + "title": "Hugo DoIt theme configuration", + "description": "The configuration for the Hugo DoIt theme", + "type": "object", + "properties": { + "baseURL": { + "type": "string", + "description": "Hostname (and path) to the root.", + "examples": ["https://hugodoit.pages.dev"] }, - "required": ["theme"] -} \ No newline at end of file + "defaultContentLanguage": { + "type": "string", + "description": "Content without language indicator will default to this language.", + "examples": ["en", "zh-cn", "fr", "pl"], + "default": "en" + }, + "theme": { + "type": ["string", "array"], + "default": "DoIt", + "minItems": 1, + "pattern": "^DoIt$", + "contains": { + "pattern": "^DoIt$" + } + } + }, + "required": ["theme"] +} diff --git a/exampleSite/static/site.webmanifest b/exampleSite/static/site.webmanifest index 452bd1095..df123a818 100644 --- a/exampleSite/static/site.webmanifest +++ b/exampleSite/static/site.webmanifest @@ -1,28 +1,28 @@ { - "name": "DoIt Theme Documentation", - "short_name": "DoIt Docs", - "description": "The documentation site for Hugo DoIt Theme", - "start_url": "/", - "theme_color": "#ffffff", - "background_color": "#ffffff", - "orientation": "portrait", - "display": "standalone", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "/apple-touch-icon.png", - "sizes": "180x180", - "type": "image/png", - "purpose": "any maskable" - } - ] -} \ No newline at end of file + "name": "DoIt Theme Documentation", + "short_name": "DoIt Docs", + "description": "The documentation site for Hugo DoIt Theme", + "start_url": "/", + "theme_color": "#ffffff", + "background_color": "#ffffff", + "orientation": "portrait", + "display": "standalone", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/apple-touch-icon.png", + "sizes": "180x180", + "type": "image/png", + "purpose": "any maskable" + } + ] +} diff --git a/package.json b/package.json index d91048dc8..b93d98c3e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "server:production": "hugo server --source=exampleSite --themesDir ../.. --disableFastRender -e production", "server:tailwind": "npx tailwindcss --watch -i ./assets/css/tailwind.css -o ./assets/css/main.css", "algolia": "atomic-algolia", - "build:tailwind": "npx tailwindcss -i ./assets/css/tailwind.css -o ./assets/css/main.css" + "build:tailwind": "npx tailwindcss -i ./assets/css/tailwind.css -o ./assets/css/main.css", + "format": "npx prettier . --write" }, "repository": { "type": "git",