mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-30 02:02:40 +00:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 193fd1933d | |||
| c9a3a6f899 | |||
| c9e01dd090 | |||
| 9293ee27f3 | |||
| 92d0a857c1 | |||
| 3e8bdfd8f9 | |||
| d9043280fe | |||
| 3408f1596a | |||
| 89f9373bae | |||
| fb4f1f7389 | |||
| 0ce74d82f8 | |||
| a5614505bc | |||
| 6123eaac2c | |||
| ad092e7f72 | |||
| b2e6f70a81 | |||
| c4a1c79972 | |||
| 87ca54d024 | |||
| cfe1d7a601 | |||
| 7788eded58 | |||
| 6a1ed440df | |||
| 5b0a27125c | |||
| 2cb4bb2966 | |||
| 74f999995f | |||
| a85a665530 | |||
| 35413d613f | |||
| d1d3ed2954 | |||
| 9c8c0b6dee | |||
| 0cf0d4f4e7 | |||
| e663ebbd45 | |||
| 6eb582fef7 | |||
| 3053d889e2 | |||
| f7a9c52aac | |||
| 78971cdedb | |||
| d41e53bba4 | |||
| cb0d63717b | |||
| b45ab833d5 | |||
| 450e774d3c | |||
| a93f67762f | |||
| c21914dd49 | |||
| 1360438540 | |||
| 669f836488 | |||
| e62c0f2409 | |||
| de72a8c802 | |||
| f5b867d717 | |||
| 5ba4a8145b | |||
| 80e4d07294 | |||
| c2dc17e9e0 | |||
| b7edbf3e49 | |||
| adeecfb69d | |||
| 64378cb9c0 | |||
| 12c64431cb | |||
| 142e933fa2 | |||
| 1a43881170 | |||
| b0170f55f0 | |||
| 40c5dcb8c2 | |||
| ed14126001 | |||
| 22c3353dde | |||
| 2b936cb6ad | |||
| e2afa113be | |||
| 6c7145c311 | |||
| 8212d6fd02 |
@@ -5,9 +5,11 @@ on:
|
||||
workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the GitHub Actions Workflow page directly
|
||||
permissions:
|
||||
contents: write # To write the generated contents to the readme
|
||||
pull-requests: write # To create a pull request
|
||||
|
||||
jobs:
|
||||
generate-component-list:
|
||||
if: github.repository == 'hugo-fixit/FixIt'
|
||||
name: Update this repo's README with the list of hugo-fixit theme components
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -21,8 +23,18 @@ jobs:
|
||||
comment_tag_name: HUGO_FIXIT_COMPONENTS
|
||||
readme_path: 'README.md,README.zh-cn.md'
|
||||
template: "- [{$repo.name}]({$repo.html_url})\\\n {$repo.description}"
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
# - name: Commit changes
|
||||
# uses: stefanzweifel/git-auto-commit-action@v5
|
||||
# with:
|
||||
# commit_message: ':memo: Docs: update hugo-fixit component list'
|
||||
# commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
commit_message: ':memo: Docs: update hugo-fixit component list'
|
||||
commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
|
||||
title: 'Update hugo-fixit component list'
|
||||
commit-message: ':memo: Docs: update hugo-fixit component list'
|
||||
body: 'This PR updates the hugo-fixit component list in the README.'
|
||||
base: main
|
||||
branch: update-component-list
|
||||
labels: documentation
|
||||
reviewers: Lruihao
|
||||
|
||||
+3
-1
@@ -10,7 +10,9 @@ jsconfig.json
|
||||
node_modules/
|
||||
|
||||
# VSCode
|
||||
.vscode
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
!.vscode/settings.json
|
||||
|
||||
# OS Files
|
||||
## Windows
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"budparr.language-hugo-vscode",
|
||||
"kaellarkin.hugo-shortcode-syntax",
|
||||
"eliostruyf.vscode-hugo-themer"
|
||||
]
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"todo-tree.tree.scanMode": "workspace only",
|
||||
"explorer.fileNesting.enabled": true,
|
||||
"explorer.fileNesting.patterns": {
|
||||
"tsconfig.json": "tsconfig.*.json, env.d.ts",
|
||||
"vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
|
||||
"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .oxlint*, oxlint*, .prettier*, prettier*, .editorconfig"
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -15,7 +15,7 @@ git clone https://github.com/hugo-fixit/FixIt.git && cd FixIt
|
||||
Then, install the dev dependencies.
|
||||
|
||||
```bash
|
||||
npm install
|
||||
pnpm install
|
||||
```
|
||||
|
||||
And now you are ready to go!
|
||||
@@ -24,15 +24,15 @@ Here are some useful commands.
|
||||
|
||||
```bash
|
||||
# run a local debugging server with watch
|
||||
npm run server
|
||||
pnpm server
|
||||
# run a local debugging server with watch in production environment
|
||||
npm run server:production
|
||||
pnpm server:production
|
||||
```
|
||||
|
||||
If you want to do docs-related theme changes, the simplest way is to have both `FixIt` and `fixit-docs` cloned as sibling directories, and then run:
|
||||
|
||||
```bash
|
||||
npm run server:docs
|
||||
pnpm server:docs
|
||||
```
|
||||
|
||||
Finally, create a new pull request at <https://github.com/hugo-fixit/FixIt/pulls> to submit your contribution 🎉
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
> It is based on the original [LoveIt](https://github.com/dillonzq/LoveIt) Theme, [KeepIt](https://github.com/Fastbyte01/KeepIt) Theme and [LeaveIt](https://github.com/liuzc/LeaveIt) Theme.
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/hugo-fixit/FixIt)
|
||||
|
||||
@@ -131,12 +131,12 @@ Click the following links to generate a new repository with template:
|
||||
|
||||
### Extended Features
|
||||
|
||||
- **AI Summary**, **AI Search** and **AI Chatbot** supported by [PostChat](https://ai.tianli0.top/?InviteID=IRE1S88Z)
|
||||
- **AI Summary**, **AI Search** and **AI Chatbot** supported by [PostChat](https://ai.zhheo.com/console/login?InviteID=85041330)
|
||||
- **PWA (Progressive Web App)** supported
|
||||
- **Sub Menu** supported
|
||||
- **Content Encryption** supported (Pages, Partial)
|
||||
- **Friends** page embedded template
|
||||
- **Search** supported by [algolia](https://www.algolia.com/), [Fuse.js](https://fusejs.io/), CSE or [PostChat](https://ai.tianli0.top/?InviteID=IRE1S88Z)
|
||||
- **Search** supported by [algolia](https://www.algolia.com/), [Fuse.js](https://fusejs.io/), CSE or [PostChat](https://ai.zhheo.com/console/login?InviteID=85041330)
|
||||
- **Custom Search Engine (CSE)** supported by [Google](https://programmablesearchengine.google.com/)
|
||||
- **Twemoji** supported
|
||||
- Automatically **highlighting** code
|
||||
@@ -145,7 +145,7 @@ Click the following links to generate a new repository with template:
|
||||
- Extended Markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
|
||||
- Extended Markdown syntax for **ruby annotation**
|
||||
- Extended Markdown syntax for **fraction**
|
||||
- **Mathematical formula** supported by [KaTeX](https://katex.org/)
|
||||
- **Mathematical formula** supported by [KaTeX](https://katex.org/) or [MathJax](https://www.mathjax.org)
|
||||
- **Diagrams** code fences extended and shortcode supported by [mermaid](https://github.com/knsv/mermaid)
|
||||
- **Interactive data visualization** shortcode and code fences extended supported by [ECharts](https://echarts.apache.org/)
|
||||
- **Timeline** code fences extended and shortcode supported
|
||||
@@ -200,7 +200,7 @@ The FixIt theme balances **simplicity** and **extensibility** with extra [Hugo t
|
||||
- [fixit-bundle](https://github.com/hugo-fixit/fixit-bundle)\
|
||||
🌲 Bundles the FixIt core theme and all hugo-fixit components into a single component.
|
||||
- [cmpt-flyfish](https://github.com/hugo-fixit/cmpt-flyfish)\
|
||||
🐟 一个 canvas 实现的小鱼游动动画效果。
|
||||
🐟 A canvas implemented animation effect of small fish swimming.
|
||||
- [cmpt-mdevtools](https://github.com/hugo-fixit/cmpt-mdevtools)\
|
||||
Mobile devtools component powered by vConsole and eruda.
|
||||
- [cmpt-translate](https://github.com/hugo-fixit/cmpt-translate)\
|
||||
@@ -214,9 +214,11 @@ The FixIt theme balances **simplicity** and **extensibility** with extra [Hugo t
|
||||
- [shortcode-asciinema](https://github.com/hugo-fixit/shortcode-asciinema)\
|
||||
A Hugo theme component with asciinema-embed shortcode.
|
||||
- [shortcode-caniuse](https://github.com/hugo-fixit/shortcode-caniuse)\
|
||||
一个含有 caniuse shortcode 的 Hugo 主题组件。
|
||||
A Hugo theme component with caniuse shortcode.
|
||||
- [shortcode-docs-bookmark](https://github.com/hugo-fixit/shortcode-docs-bookmark)\
|
||||
🔖 Embed bookmark of FixIt Docs.
|
||||
- [shortcode-mmt-netease](https://github.com/hugo-fixit/shortcode-mmt-netease)\
|
||||
🎶 A Hugo theme component with a NetEase Cloud random comment shortcode.
|
||||
- [shortcode-rewards](https://github.com/hugo-fixit/shortcode-rewards)\
|
||||
A Hugo theme component with reward-log or sponsor-log shortcode.
|
||||
<!-- HUGO_FIXIT_COMPONENTS:END -->
|
||||
@@ -271,6 +273,7 @@ Thanks to all the [contributors](https://github.com/hugo-fixit/FixIt/graphs/cont
|
||||
- [Sharer.js](https://github.com/ellisonleao/sharer.js)
|
||||
- [TypeIt](https://typeitjs.com/)
|
||||
- [KaTeX](https://katex.org/)
|
||||
- [MathJax](https://www.mathjax.org)
|
||||
- [mermaid](https://github.com/mermaid-js/mermaid)
|
||||
- [ECharts](https://echarts.apache.org/)
|
||||
- [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js)
|
||||
|
||||
+9
-6
@@ -25,7 +25,7 @@
|
||||
> 它的原型基于 [LoveIt](https://github.com/dillonzq/LoveIt) 主题,[KeepIt](https://github.com/Fastbyte01/KeepIt) 主题和 [LeaveIt](https://github.com/liuzc/LeaveIt) 主题。
|
||||
|
||||
[](https://github.com/hugo-fixit/FixIt/releases)
|
||||
[](https://gohugo.io/)
|
||||
[](https://gohugo.io/)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/hugo-fixit/FixIt)
|
||||
|
||||
@@ -135,12 +135,12 @@ Gitee 镜像仓库:<https://gitee.com/lruihao/FixIt>
|
||||
|
||||
### 扩展功能
|
||||
|
||||
- 支持基于 [PostChat](https://ai.tianli0.top/?InviteID=IRE1S88Z) 的 **AI 摘要**、**AI 搜索** 和 **AI 智能客服**
|
||||
- 支持基于 [PostChat](https://ai.zhheo.com/console/login?InviteID=85041330) 的 **AI 摘要**、**AI 搜索** 和 **AI 智能客服**
|
||||
- 支持**渐进式网页应用**
|
||||
- 支持**二级菜单**
|
||||
- 支持**内容加密**(页面、局部)
|
||||
- 支持**友情链接**的页面模板
|
||||
- 支持基于 [algolia](https://www.algolia.com/)、[Fuse.js](https://fusejs.io/)、 **CSE** 或 [PostChat](https://ai.tianli0.top/?InviteID=IRE1S88Z) 的**搜索**
|
||||
- 支持基于 [algolia](https://www.algolia.com/)、[Fuse.js](https://fusejs.io/)、 **CSE** 或 [PostChat](https://ai.zhheo.com/console/login?InviteID=85041330) 的**搜索**
|
||||
- 支持基于 [Google](https://programmablesearchengine.google.com/) 的**自定义搜索引擎 (CSE)**
|
||||
- 支持 **Twemoji**
|
||||
- 支持**代码高亮**
|
||||
@@ -149,7 +149,7 @@ Gitee 镜像仓库:<https://gitee.com/lruihao/FixIt>
|
||||
- 支持 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法
|
||||
- 支持**上标注释**的扩展 Markdown 语法
|
||||
- 支持**分数**的扩展 Markdown 语法
|
||||
- 支持基于 [KaTeX](https://katex.org/) 的**数学公式**
|
||||
- 支持基于 [KaTeX](https://katex.org/) 或 [MathJax](https://www.mathjax.org) 的**数学公式**
|
||||
- 支持基于 [mermaid](https://github.com/knsv/mermaid) 的**图表** 代码块扩展语法和 shortcode
|
||||
- 支持基于 [ECharts](https://echarts.apache.org/) 的**交互式数据可视化** 代码块扩展语法和 shortcode
|
||||
- 支持 **Timeline** 的代码块扩展语法和 shortcode
|
||||
@@ -204,7 +204,7 @@ FixIt 主题旨在在**简洁性**和**可扩展性**之间取得平衡。为此
|
||||
- [fixit-bundle](https://github.com/hugo-fixit/fixit-bundle)\
|
||||
🌲 Bundles the FixIt core theme and all hugo-fixit components into a single component.
|
||||
- [cmpt-flyfish](https://github.com/hugo-fixit/cmpt-flyfish)\
|
||||
🐟 一个 canvas 实现的小鱼游动动画效果。
|
||||
🐟 A canvas implemented animation effect of small fish swimming.
|
||||
- [cmpt-mdevtools](https://github.com/hugo-fixit/cmpt-mdevtools)\
|
||||
Mobile devtools component powered by vConsole and eruda.
|
||||
- [cmpt-translate](https://github.com/hugo-fixit/cmpt-translate)\
|
||||
@@ -218,9 +218,11 @@ FixIt 主题旨在在**简洁性**和**可扩展性**之间取得平衡。为此
|
||||
- [shortcode-asciinema](https://github.com/hugo-fixit/shortcode-asciinema)\
|
||||
A Hugo theme component with asciinema-embed shortcode.
|
||||
- [shortcode-caniuse](https://github.com/hugo-fixit/shortcode-caniuse)\
|
||||
一个含有 caniuse shortcode 的 Hugo 主题组件。
|
||||
A Hugo theme component with caniuse shortcode.
|
||||
- [shortcode-docs-bookmark](https://github.com/hugo-fixit/shortcode-docs-bookmark)\
|
||||
🔖 Embed bookmark of FixIt Docs.
|
||||
- [shortcode-mmt-netease](https://github.com/hugo-fixit/shortcode-mmt-netease)\
|
||||
🎶 A Hugo theme component with a NetEase Cloud random comment shortcode.
|
||||
- [shortcode-rewards](https://github.com/hugo-fixit/shortcode-rewards)\
|
||||
A Hugo theme component with reward-log or sponsor-log shortcode.
|
||||
<!-- HUGO_FIXIT_COMPONENTS:END -->
|
||||
@@ -275,6 +277,7 @@ FixIt 主题旨在在**简洁性**和**可扩展性**之间取得平衡。为此
|
||||
- [Sharer.js](https://github.com/ellisonleao/sharer.js)
|
||||
- [TypeIt](https://typeitjs.com/)
|
||||
- [KaTeX](https://katex.org/)
|
||||
- [MathJax](https://www.mathjax.org)
|
||||
- [mermaid](https://github.com/mermaid-js/mermaid)
|
||||
- [ECharts](https://echarts.apache.org/)
|
||||
- [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js)
|
||||
|
||||
@@ -54,6 +54,33 @@ abbr[title] {
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
img {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
img,video {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
%code {
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
font-size: $code-font-size;
|
||||
font-family: $code-font-family;
|
||||
color: $code-color;
|
||||
background-color: rgba(175, 184, 193, 0.2);
|
||||
text-decoration: inherit;
|
||||
@include border-radius($global-border-radius);
|
||||
@include overflow-wrap(break-word);
|
||||
@include line-break(auto);
|
||||
|
||||
[data-theme='dark'] & {
|
||||
color: $code-color-dark;
|
||||
background-color: rgba(99, 110, 123, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
@include link(true, true);
|
||||
|
||||
@import '../_partials/scrollbar';
|
||||
|
||||
@@ -109,8 +109,7 @@
|
||||
}
|
||||
|
||||
.page {
|
||||
.categories-card,
|
||||
.collections-card {
|
||||
.taxonomy-cards {
|
||||
.card-item {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -129,6 +128,23 @@
|
||||
}
|
||||
|
||||
@media only print {
|
||||
|
||||
// 确保打印时没有 scrollbar
|
||||
:root {
|
||||
--fi-scrollbar-width: none !important;
|
||||
}
|
||||
|
||||
*::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.scrollbar-thin {
|
||||
scrollbar-width: none !important;
|
||||
-ms-overflow-style: none !important;
|
||||
}
|
||||
|
||||
@page {
|
||||
size: A4 portrait;
|
||||
margin: 1.27cm;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
// Set breadcrumb height to 0px if breadcrumb is disabled
|
||||
--#{$prefix}breadcrumb-height: 0px;
|
||||
|
||||
// hr style
|
||||
// hr / divider style
|
||||
--#{$prefix}hr-background-color: #{darken($global-border-color, 5%)};
|
||||
--#{$prefix}hr-before-color: #{lighten($single-link-hover-color, 4%)};
|
||||
--#{$prefix}divider-edge-weak: linear-gradient(to right, transparent, var(--#{$prefix}divider-bg, #d0d0d5), transparent);
|
||||
|
||||
// Scrollbar related variables
|
||||
--#{$prefix}scrollbar-thumb-color: #{$scrollbar-color};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@import '../_partials/_single/toc';
|
||||
@import '../_partials/_single/fixit-decryptor';
|
||||
@import '../_partials/_single/collections';
|
||||
@import '../_partials/_single/related';
|
||||
|
||||
.single {
|
||||
.single-title {
|
||||
@@ -154,7 +155,7 @@
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
> .heading-element {
|
||||
.heading-element {
|
||||
display: flex;
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
@@ -165,11 +166,6 @@
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 0 .2em;
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:target {
|
||||
> .heading-mark {
|
||||
@@ -366,31 +362,9 @@
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
min-height: 1em;
|
||||
|
||||
&:not([height]) {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
&[loading='lazy'][srcset]:not([data-lazyloaded]) {
|
||||
&:not(.suffix-invalid__small) {
|
||||
width: var(--width-small, var(--width));
|
||||
aspect-ratio: var(--aspect-ratio-small, var(--aspect-ratio));
|
||||
}
|
||||
|
||||
&:not(.suffix-invalid) {
|
||||
@media (min-resolution: 1.01dppx) and (max-resolution: 1.5dppx) {
|
||||
width: calc(var(--width) / 1.5);
|
||||
aspect-ratio: var(--aspect-ratio);
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.suffix-invalid__large) {
|
||||
@media (min-resolution: 1.51dppx) {
|
||||
width: calc(var(--width-large, var(--width)) / 2);
|
||||
aspect-ratio: var(--aspect-ratio-large, var(--aspect-ratio));
|
||||
}
|
||||
}
|
||||
// SVG performs differently in Safari compared to other browsers
|
||||
&:not([src*='.svg']) {
|
||||
min-height: 1em;
|
||||
}
|
||||
|
||||
&.version {
|
||||
@@ -419,6 +393,7 @@
|
||||
img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
@@ -517,11 +492,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Katex styles
|
||||
// KaTeX styles
|
||||
.katex-display {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
padding-block: 2px;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.katex-error {
|
||||
padding: 0.14em 0.28em;
|
||||
background-color: mark;
|
||||
cursor: help;
|
||||
@include border-radius($global-border-radius);
|
||||
}
|
||||
|
||||
// MathJax styles
|
||||
mjx-container[jax='CHTML'][display='true'] {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
@import '../_partials/_single/alert';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.categories-card,
|
||||
.collections-card {
|
||||
.taxonomy-cards {
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
// inline code
|
||||
code {
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
font-size: $code-font-size;
|
||||
font-family: $code-font-family;
|
||||
color: $code-color;
|
||||
background-color: rgba(175, 184, 193, 0.2);
|
||||
text-decoration: inherit;
|
||||
@include border-radius($global-border-radius);
|
||||
@include overflow-wrap(break-word);
|
||||
@include line-break(auto);
|
||||
|
||||
[data-theme='dark'] & {
|
||||
color: $code-color-dark;
|
||||
background-color: rgba(99, 110, 123, 0.4);
|
||||
}
|
||||
@extend %code;
|
||||
}
|
||||
|
||||
// indented code
|
||||
@@ -23,7 +9,7 @@ pre:not(.mermaid[data-processed='true']) {
|
||||
line-height: 1.45em;
|
||||
padding: 0.5rem;
|
||||
overflow: auto;
|
||||
font-size: $code-font-size;
|
||||
font-size: $code-block-font-size;
|
||||
font-family: $code-font-family;
|
||||
@include border-radius($global-border-radius);
|
||||
@include tab-size(4);
|
||||
@@ -37,6 +23,7 @@ pre:not(.mermaid[data-processed='true']) {
|
||||
code {
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
font-size: inherit;
|
||||
@include border-radius(0);
|
||||
@include max-content(min-width);
|
||||
|
||||
@@ -54,7 +41,7 @@ pre:not(.mermaid[data-processed='true']) {
|
||||
|
||||
.highlight,
|
||||
.gist {
|
||||
font-size: $code-font-size;
|
||||
font-size: $code-block-font-size;
|
||||
font-family: $code-font-family;
|
||||
|
||||
.table-wrapper {
|
||||
@@ -354,6 +341,7 @@ pre:not(.mermaid[data-processed='true']) {
|
||||
.gist-meta {
|
||||
padding: 0.4rem 0.8rem;
|
||||
@include link(false, false);
|
||||
@include border-radius(0 0 $global-border-radius $global-border-radius);
|
||||
background-color: darken($code-background-color, 5%);
|
||||
|
||||
[data-theme='dark'] & {
|
||||
@@ -362,12 +350,15 @@ pre:not(.mermaid[data-processed='true']) {
|
||||
}
|
||||
|
||||
.table-wrapper {
|
||||
.highlight {
|
||||
background-color: $code-background-color;
|
||||
padding-block: 0.25rem;
|
||||
@include border-radius($global-border-radius $global-border-radius 0 0);
|
||||
background-color: $code-background-color;
|
||||
|
||||
[data-theme='dark'] & {
|
||||
background-color: $code-background-color-dark;
|
||||
}
|
||||
[data-theme='dark'] & {
|
||||
background-color: $code-background-color-dark;
|
||||
}
|
||||
.highlight {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// Related Content List (aside)
|
||||
.related-details {
|
||||
&:not(:first-of-type)::before {
|
||||
content: '';
|
||||
display: block;
|
||||
border: 0;
|
||||
padding-top: 1px;
|
||||
background: var(--#{$prefix}divider-edge-weak);
|
||||
margin-block: 1rem 0.5rem;
|
||||
}
|
||||
|
||||
&:not(:last-of-type) {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.related-summary {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 0.25em;
|
||||
padding: 0.2em 0.5em;
|
||||
|
||||
> i.fa-layer-group {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.related-title {
|
||||
font-weight: bold;
|
||||
font-size: $related-title-font-size;
|
||||
}
|
||||
|
||||
.related-count {
|
||||
flex-shrink: 0;
|
||||
color: var(--#{$prefix}secondary);
|
||||
}
|
||||
|
||||
.details-icon {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@include user-select(none);
|
||||
}
|
||||
|
||||
.related-content {
|
||||
font-size: $related-list-font-size;
|
||||
|
||||
.related-list {
|
||||
margin: 0;
|
||||
padding-inline: 1.6em 0.8em;
|
||||
padding-block: 0.4em;
|
||||
text-indent: -0.8em;
|
||||
list-style: none;
|
||||
overflow-y: scroll;
|
||||
max-height: 60vh;
|
||||
@include scrollbar-width(none, 0);
|
||||
|
||||
.related-item > a::before,
|
||||
.related-item > span::before {
|
||||
content: '|';
|
||||
font-weight: 600;
|
||||
margin-right: 0.5em;
|
||||
position: relative;
|
||||
bottom: 2px;
|
||||
color: $single-link-color;
|
||||
|
||||
[data-theme='dark'] & {
|
||||
color: $single-link-color-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
.toc-content {
|
||||
font-size: $toc-content-font-size;
|
||||
|
||||
code {
|
||||
@extend %code;
|
||||
}
|
||||
|
||||
ul {
|
||||
text-indent: -0.8em;
|
||||
padding-left: 0.8em;
|
||||
@@ -110,7 +114,8 @@
|
||||
|
||||
.toc-content {
|
||||
overflow-y: scroll;
|
||||
max-height: calc(100vh - #{2*$header-height});
|
||||
// TODO 这里计算错误,待重构
|
||||
max-height: calc(100vh - #{2 * $header-height});
|
||||
@include scrollbar-width(none, 0);
|
||||
|
||||
&.always-active ul,
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
@import '_widgets/fixed-button';
|
||||
@import '_widgets/github-corner';
|
||||
@import '_widgets/noscript-warning';
|
||||
@import '_widgets/post-chat';
|
||||
@import '_widgets/reading-progress';
|
||||
@import '_widgets/typeit';
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#postChat_button,
|
||||
.post-TianliGPT {
|
||||
@extend .print-d-none;
|
||||
}
|
||||
@@ -1,37 +1,13 @@
|
||||
.reading-progress-bar {
|
||||
height: var(--#{$prefix}progress-h, 2px);
|
||||
background-color: var(--#{$prefix}progress-bg, var(--#{$prefix}info));
|
||||
--progress: 0;
|
||||
height: var(--progress-h, 2px);
|
||||
width: var(--progress);
|
||||
background-color: var(--bg-progress, var(--#{$prefix}info));
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform-origin: var(--#{$prefix}progress-start, left) 50%;
|
||||
animation: grow-progress 3s linear;
|
||||
animation-timeline: scroll();
|
||||
@include z-index(2);
|
||||
@extend .print-d-none;
|
||||
|
||||
&[data-reversed=true] {
|
||||
animation-name: grow-progress-reversed;
|
||||
}
|
||||
|
||||
[data-theme="dark"] & {
|
||||
background-color: var(--#{$prefix}progress-bg-dark, var(--#{$prefix}info-dark));
|
||||
}
|
||||
|
||||
@keyframes grow-progress {
|
||||
from { transform: scaleX(0); }
|
||||
to { transform: scaleX(1); }
|
||||
}
|
||||
@keyframes grow-progress-reversed {
|
||||
from { transform: scaleX(1); }
|
||||
to { transform: scaleX(0); }
|
||||
}
|
||||
|
||||
/**
|
||||
* After the CSS property `animation-timeline: scroll()` exceeds 90% browser support in the future, this code can be removed
|
||||
* See https://caniuse.com/mdn-css_properties_animation-timeline_scroll
|
||||
*/
|
||||
@supports not (animation-timeline: scroll()) {
|
||||
display: none;
|
||||
background-color: var(--bg-progress-dark, var(--#{$prefix}info-dark));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,10 @@ $toc-content-font-size: 0.875rem !default;
|
||||
$collection-title-font-size: 1rem !default;
|
||||
$collection-list-font-size: 0.875rem !default;
|
||||
|
||||
// Font size of the Related Content List
|
||||
$related-title-font-size: 1rem !default;
|
||||
$related-list-font-size: 0.875rem !default;
|
||||
|
||||
// Color of the single link
|
||||
$single-link-color: #2376b7 !default; // 花青
|
||||
$single-link-color-dark: #1781b5 !default; // 釉蓝
|
||||
@@ -160,7 +164,8 @@ $code-info-color: #9c9c9c !default;
|
||||
$code-info-color-dark: #b1b0b0 !default;
|
||||
|
||||
// Font size of the code
|
||||
$code-font-size: 0.875rem !default;
|
||||
$code-font-size: 0.875em !default;
|
||||
$code-block-font-size: 0.875rem !default;
|
||||
|
||||
// Font family of the code
|
||||
$code-font-family: Source Code Pro, Menlo, Consolas, Monaco, monospace, $global-font-family !default;
|
||||
|
||||
@@ -39,12 +39,9 @@ libFiles:
|
||||
gitalkJS: gitalk@1.7.2/dist/gitalk.min.js
|
||||
# instant.page@5.2.0 https://github.com/instantpage/instant.page
|
||||
instantPage: instant.page@5.2.0/instantpage.min.js
|
||||
# katex@0.16.10 https://github.com/KaTeX/KaTeX
|
||||
katexAutoRenderJS: katex@0.16.10/dist/contrib/auto-render.min.js
|
||||
katexCopyTexJS: katex@0.16.10/dist/contrib/copy-tex.min.js
|
||||
katexCSS: katex@0.16.10/dist/katex.min.css
|
||||
katexJS: katex@0.16.10/dist/katex.min.js
|
||||
katexMhchemJS: katex@0.16.10/dist/contrib/mhchem.min.js
|
||||
# katex@0.16.22 https://github.com/KaTeX/KaTeX
|
||||
katexCopyTexJS: katex@0.16.22/dist/contrib/copy-tex.min.js
|
||||
katexCSS: katex@0.16.22/dist/katex.min.css
|
||||
# lightgallery@2.7.2 https://github.com/sachinchoolur/lightgallery
|
||||
lightgalleryCSS: lightgallery@2.7.2/css/lightgallery-bundle.min.css
|
||||
lightgalleryJS: lightgallery@2.7.2/lightgallery.min.js
|
||||
@@ -66,8 +63,8 @@ libFiles:
|
||||
sharerJS: sharer.js@0.5.1/sharer.min.js
|
||||
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
||||
# twikoo@1.6.22 https://github.com/imaegoo/twikoo
|
||||
twikooJS: twikoo@1.6.22/dist/twikoo.all.min.js
|
||||
# twikoo@1.6.44 https://github.com/imaegoo/twikoo
|
||||
twikooJS: twikoo@1.6.44/dist/twikoo.all.min.js
|
||||
# typeit@8.8.4 https://github.com/alexmacarthur/typeit
|
||||
typeitJS: typeit@8.8.4/dist/index.umd.js
|
||||
# valine@1.5.2 https://github.com/xCss/Valine
|
||||
|
||||
@@ -39,12 +39,9 @@ libFiles:
|
||||
gitalkJS: gitalk@1.7.2/dist/gitalk.min.js
|
||||
# instant.page@5.2.0 https://github.com/instantpage/instant.page
|
||||
instantPage: instant.page@5.2.0/instantpage.js
|
||||
# katex@0.16.10 https://github.com/KaTeX/KaTeX
|
||||
katexAutoRenderJS: katex@0.16.10/dist/contrib/auto-render.min.js
|
||||
katexCopyTexJS: katex@0.16.10/dist/contrib/copy-tex.min.js
|
||||
katexCSS: katex@0.16.10/dist/katex.min.css
|
||||
katexJS: katex@0.16.10/dist/katex.min.js
|
||||
katexMhchemJS: katex@0.16.10/dist/contrib/mhchem.min.js
|
||||
# katex@0.16.22 https://github.com/KaTeX/KaTeX
|
||||
katexCopyTexJS: katex@0.16.22/dist/contrib/copy-tex.min.js
|
||||
katexCSS: katex@0.16.22/dist/katex.min.css
|
||||
# lightgallery@2.7.2 https://github.com/sachinchoolur/lightgallery
|
||||
lightgalleryCSS: lightgallery@2.7.2/css/lightgallery-bundle.min.css
|
||||
lightgalleryJS: lightgallery@2.7.2/lightgallery.min.js
|
||||
@@ -66,8 +63,8 @@ libFiles:
|
||||
sharerJS: sharer.js@0.5.1/sharer.min.js
|
||||
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
||||
# twikoo@1.6.22 https://github.com/imaegoo/twikoo
|
||||
twikooJS: twikoo@1.6.22/dist/twikoo.all.min.js
|
||||
# twikoo@1.6.44 https://github.com/imaegoo/twikoo
|
||||
twikooJS: twikoo@1.6.44/dist/twikoo.all.min.js
|
||||
# typeit@8.8.4 https://github.com/alexmacarthur/typeit
|
||||
typeitJS: typeit@8.8.4/dist/index.umd.js
|
||||
# valine@1.5.2 https://github.com/xCss/Valine
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import * as params from '@params'
|
||||
|
||||
/**
|
||||
* Load MathJax script dynamically
|
||||
*/
|
||||
function loadMathJax() {
|
||||
const script = document.createElement('script')
|
||||
script.src = params.cdn || 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
|
||||
script.async = true
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuring MathJax
|
||||
* https://docs.mathjax.org/en/latest/options/index.html
|
||||
*/
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
displayMath: [['\\[', '\\]'], ['$$', '$$']],
|
||||
inlineMath: [['\\(', '\\)'], ['$', '$']],
|
||||
packages: {
|
||||
...params.packages,
|
||||
},
|
||||
// custom macros
|
||||
macros: {
|
||||
// make \KaTeX command work in MathJax
|
||||
KaTeX: '{K\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX}',
|
||||
...params.macros,
|
||||
},
|
||||
...params.tex,
|
||||
},
|
||||
loader: {
|
||||
...params.loader,
|
||||
failed: function (error) {
|
||||
console.error(`MathJax(${error.package || '?'}): ${error.message}`);
|
||||
},
|
||||
},
|
||||
options: {
|
||||
ignoreHtmlClass: 'comment',
|
||||
processHtmlClass: 'content',
|
||||
...params.options,
|
||||
}
|
||||
}
|
||||
|
||||
loadMathJax()
|
||||
+59
-16
@@ -1,3 +1,4 @@
|
||||
// TODO use ESLint to check the code style
|
||||
import Util from './util';
|
||||
|
||||
class FixIt {
|
||||
@@ -635,12 +636,6 @@ class FixIt {
|
||||
}
|
||||
}
|
||||
|
||||
initMath(target = document.body) {
|
||||
if (this.config.math) {
|
||||
renderMathInElement(target, this.config.math);
|
||||
}
|
||||
}
|
||||
|
||||
initMermaid() {
|
||||
if (!this.config.mermaid) {
|
||||
return;
|
||||
@@ -683,12 +678,53 @@ class FixIt {
|
||||
this._echartsArr = [];
|
||||
const stagingDOM = this.util.getStagingDOM()
|
||||
this.util.forEach(document.getElementsByClassName('echarts'), ($echarts) => {
|
||||
if ($echarts.nextElementSibling.tagName === 'TEMPLATE') {
|
||||
const chart = echarts.init($echarts, this.isDark ? 'dark' : 'light', { renderer: 'svg' });
|
||||
stagingDOM.stage($echarts.nextElementSibling.content.cloneNode(true));
|
||||
chart.setOption(stagingDOM.contentAsJson());
|
||||
this._echartsArr.push(chart);
|
||||
const $dataEl = $echarts.nextElementSibling;
|
||||
if ($dataEl.tagName !== 'TEMPLATE') {
|
||||
return;
|
||||
}
|
||||
const chart = echarts.init($echarts, this.isDark ? 'dark' : 'light', { renderer: 'svg' });
|
||||
chart.showLoading();
|
||||
stagingDOM.stage($dataEl.content.cloneNode(true));
|
||||
const _setOption = (option) => {
|
||||
if (!option) {
|
||||
chart.hideLoading();
|
||||
console.warn('ECharts option is missing or invalid. Chart disposed.', {
|
||||
element: $echarts,
|
||||
option: $dataEl,
|
||||
});
|
||||
chart.dispose();
|
||||
$echarts.removeAttribute('style');
|
||||
return;
|
||||
}
|
||||
chart.hideLoading();
|
||||
chart.setOption(option);
|
||||
this._echartsArr.push(chart);
|
||||
};
|
||||
// support JS object literal or JS code
|
||||
if ($dataEl.dataset.fmt === 'js') {
|
||||
try {
|
||||
const jsCodes = stagingDOM.contentAsText();
|
||||
/**
|
||||
* Get ECharts option
|
||||
* @param {Object} fixit FixIt instance
|
||||
* @param {Object} chart ECharts instance
|
||||
* @returns {Object|Promise} ECharts option or Promise
|
||||
*/
|
||||
const _getOption = new Function('fixit', 'chart',
|
||||
this.util.isObjectLiteral(jsCodes) ? `return ${jsCodes}` : jsCodes
|
||||
);
|
||||
if ($dataEl.dataset.async === 'true') {
|
||||
return Promise.resolve(_getOption(this, chart)).then(option => {
|
||||
_setOption(option);
|
||||
});
|
||||
}
|
||||
return _setOption(_getOption(this, chart));
|
||||
} catch (err) {
|
||||
return console.error(err);
|
||||
}
|
||||
}
|
||||
// support JSON
|
||||
_setOption(stagingDOM.contentAsJson());
|
||||
});
|
||||
stagingDOM.destroy();
|
||||
});
|
||||
@@ -1058,6 +1094,10 @@ class FixIt {
|
||||
pangu.autoSpacingPage();
|
||||
}
|
||||
|
||||
initMathJax() {
|
||||
window.MathJax?.typeset && window.MathJax.typeset();
|
||||
}
|
||||
|
||||
initFixItDecryptor() {
|
||||
this.decryptor = new FixItDecryptor({
|
||||
decrypted: () => {
|
||||
@@ -1066,15 +1106,15 @@ class FixIt {
|
||||
this.initLightGallery();
|
||||
this.initCodeWrapper();
|
||||
this.initTable();
|
||||
this.initMath();
|
||||
this.initMermaid();
|
||||
this.initEcharts();
|
||||
this.initTypeit();
|
||||
this.initMapbox();
|
||||
this.fixTocScroll();
|
||||
this.initToc();
|
||||
this.initTocListener();
|
||||
this.initPangu();
|
||||
this.fixTocScroll();
|
||||
this.initMathJax();
|
||||
this.util.forEach(document.querySelectorAll('.encrypted-hidden'), ($element) => {
|
||||
$element.classList.replace('encrypted-hidden', 'decrypted-shown');
|
||||
});
|
||||
@@ -1085,12 +1125,12 @@ class FixIt {
|
||||
this.initLightGallery();
|
||||
this.initCodeWrapper();
|
||||
this.initTable($content);
|
||||
this.initMath($content);
|
||||
this.initMermaid();
|
||||
this.initEcharts();
|
||||
this.initTypeit($content);
|
||||
this.initMapbox();
|
||||
this.initPangu();
|
||||
this.initMathJax();
|
||||
this.util.forEach($content.querySelectorAll('.encrypted-hidden'), ($element) => {
|
||||
$element.classList.replace('encrypted-hidden', 'decrypted-shown');
|
||||
});
|
||||
@@ -1171,6 +1211,7 @@ class FixIt {
|
||||
const ACCURACY = 20;
|
||||
const $fixedButtons = document.querySelector('.fixed-buttons');
|
||||
const $backToTop = document.querySelector('.back-to-top');
|
||||
const $readingProgressBar = document.querySelector('.reading-progress-bar');
|
||||
if (document.body.dataset.headerDesktop === 'auto') {
|
||||
$headers.push(document.getElementById('header-desktop'));
|
||||
}
|
||||
@@ -1203,6 +1244,9 @@ class FixIt {
|
||||
});
|
||||
const contentHeight = document.body.scrollHeight - window.innerHeight;
|
||||
const scrollPercent = Math.max(Math.min(100 * Math.max(this.newScrollTop, 0) / contentHeight, 100), 0);
|
||||
if ($readingProgressBar) {
|
||||
$readingProgressBar.style.setProperty('--progress', `${scrollPercent.toFixed(2)}%`);
|
||||
}
|
||||
// whether to show fixed buttons
|
||||
if ($fixedButtons) {
|
||||
if (scrollPercent > 1) {
|
||||
@@ -1282,7 +1326,6 @@ class FixIt {
|
||||
this.initLightGallery();
|
||||
this.initCodeWrapper();
|
||||
this.initTable();
|
||||
this.initMath();
|
||||
this.initMermaid();
|
||||
this.initEcharts();
|
||||
this.initTypeit();
|
||||
@@ -1306,9 +1349,9 @@ class FixIt {
|
||||
window.setTimeout(() => {
|
||||
this.initComment();
|
||||
if (!this.config.encryption?.all) {
|
||||
this.fixTocScroll();
|
||||
this.initToc();
|
||||
this.initTocListener();
|
||||
this.fixTocScroll();
|
||||
}
|
||||
this.onScroll();
|
||||
this.onResize();
|
||||
|
||||
+19
-2
@@ -42,7 +42,7 @@ export default class Util {
|
||||
isValidDate(date) {
|
||||
return date instanceof Date && !isNaN(date.getTime());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* scroll some element into view
|
||||
* @param {String} selector element to scroll
|
||||
@@ -109,6 +109,23 @@ export default class Util {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
return this.copyText(text);
|
||||
return this.copyText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a string is a JS object string
|
||||
* @example isObjectLiteral("{a:1,b:2}") // true
|
||||
* @param {String} str string to check
|
||||
* @returns {Boolean} whether the string is a JS object string
|
||||
*/
|
||||
isObjectLiteral(str) {
|
||||
if (typeof str !== 'string') {
|
||||
return false;
|
||||
}
|
||||
str = str.replace(/\s+/g, ' ').trim().replace(/;$/, '')
|
||||
if (str.startsWith('{') && str.endsWith('}')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -13,7 +13,7 @@ fontawesome-free@6.7.1 https://github.com/FortAwesome/Font-Awesome
|
||||
fusejs@6.6.2 https://github.com/krisk/fuse
|
||||
gitalk@1.7.2 https://github.com/gitalk/gitalk
|
||||
instant.page@5.2.0 https://github.com/instantpage/instant.page
|
||||
katex@0.16.10 https://github.com/KaTeX/KaTeX
|
||||
katex@0.16.22 https://github.com/KaTeX/KaTeX
|
||||
lightgallery@2.7.2 https://github.com/sachinchoolur/lightgallery
|
||||
mapbox-gl@2.10.0 https://github.com/mapbox/mapbox-gl-js
|
||||
meting@2.0.1 https://github.com/metowolf/MetingJS
|
||||
@@ -23,7 +23,7 @@ pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
||||
sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
||||
simple-icons@9.19.0 https://github.com/simple-icons/simple-icons
|
||||
twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||
twikoo@1.6.22 https://github.com/imaegoo/twikoo
|
||||
twikoo@1.6.44 https://github.com/imaegoo/twikoo
|
||||
typeit@8.8.4 https://github.com/alexmacarthur/typeit
|
||||
valine@1.5.2 https://github.com/xCss/Valine
|
||||
waline@3.4.1 https://github.com/walinejs/waline
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};return function(){r.d(o,{default:function(){return d}});var e=r(771),t=r.n(e);const n=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},i=/^\\begin{/;var a=function(e,t){let r;const o=[],a=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;r=e.search(a),-1!==r;){r>0&&(o.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const a=t.findIndex((t=>e.startsWith(t.left)));if(r=n(t[a].right,e,t[a].left.length),-1===r)break;const l=e.slice(0,r+t[a].right.length),s=i.test(l)?l:e.slice(t[a].left.length,r);o.push({type:"math",data:s,rawData:l,display:t[a].display}),e=e.slice(r+t[a].right.length)}return""!==e&&o.push({type:"text",data:e}),o};const l=function(e,n){const r=a(e,n.delimiters);if(1===r.length&&"text"===r[0].type)return null;const o=document.createDocumentFragment();for(let e=0;e<r.length;e++)if("text"===r[e].type)o.appendChild(document.createTextNode(r[e].data));else{const i=document.createElement("span");let a=r[e].data;n.displayMode=r[e].display;try{n.preProcess&&(a=n.preProcess(a)),t().render(a,i,n)}catch(i){if(!(i instanceof t().ParseError))throw i;n.errorCallback("KaTeX auto-render: Failed to parse `"+r[e].data+"` with ",i),o.appendChild(document.createTextNode(r[e].rawData));continue}o.appendChild(i)}return o},s=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const s=l(o,t);if(s){for(let e=0;e<a;e++)r.nextSibling.remove();n+=s.childNodes.length-1,e.replaceChild(s,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&s(r,t)}}};var d=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},s(e,n)}}(),o=o.default}()}));
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -34,6 +34,8 @@ enableRobotsTXT = true
|
||||
enableGitInfo = true
|
||||
# whether to use emoji code
|
||||
enableEmoji = true
|
||||
# the main sections of a site
|
||||
mainSections = []
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Menu Configuration
|
||||
@@ -135,7 +137,7 @@ enableEmoji = true
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
extended = true
|
||||
min = "0.141.0"
|
||||
min = "0.147.7"
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Markup related configuration in Hugo
|
||||
@@ -178,13 +180,12 @@ enableEmoji = true
|
||||
enable = true
|
||||
[markup.goldmark.extensions.extras.superscript]
|
||||
enable = true
|
||||
# TODO passthrough refactor https://gohugo.io/render-hooks/passthrough/
|
||||
# TODO hugo 0.122.0 https://gohugo.io/content-management/mathematics/
|
||||
# [markup.goldmark.extensions.passthrough]
|
||||
# enable = true
|
||||
# [markup.goldmark.extensions.passthrough.delimiters]
|
||||
# block = [['\[', '\]'], ['$$', '$$']]
|
||||
# inline = [['\(', '\)'], ['$', '$']]
|
||||
# https://gohugo.io/content-management/mathematics/
|
||||
[markup.goldmark.extensions.passthrough]
|
||||
enable = true
|
||||
[markup.goldmark.extensions.passthrough.delimiters]
|
||||
block = [['\[', '\]'], ['$$', '$$']]
|
||||
inline = [['\(', '\)'], ['$', '$']]
|
||||
[markup.goldmark.parser]
|
||||
[markup.goldmark.parser.attribute]
|
||||
block = true
|
||||
@@ -889,7 +890,7 @@ enableEmoji = true
|
||||
# FixIt 0.3.17 | NEW PostChat AI config
|
||||
# Based on your posts to build a knowledge base, support AI summary, AI search, and AI Chatbot.
|
||||
# Get PostChat Key from my invitation link, thanks for your support!
|
||||
# https://ai.tianli0.top/?InviteID=IRE1S88Z
|
||||
# https://ai.zhheo.com/console/login?InviteID=85041330
|
||||
[params.postChat]
|
||||
enable = false
|
||||
key = ""
|
||||
@@ -916,9 +917,11 @@ enableEmoji = true
|
||||
userIcon = ""
|
||||
defaultChatQuestions = []
|
||||
defaultSearchQuestions = []
|
||||
# FixIt 0.4.0 | NEW
|
||||
hotWords = true
|
||||
|
||||
# FixIt 0.3.17 | NEW Summary AI config
|
||||
# See https://postchat.zhheo.com/summary.html
|
||||
# See https://ai.zhheo.com/docs/summary.html
|
||||
[params.postSummary]
|
||||
enable = false
|
||||
# If you set `params.postChat.key`, you don't need to set `params.postSummary.key`
|
||||
@@ -943,6 +946,13 @@ enableEmoji = true
|
||||
[params.feed.follow]
|
||||
feedId = ""
|
||||
userId = ""
|
||||
|
||||
# FixIt 0.3.17 | NEW Image config
|
||||
[params.image]
|
||||
# cache remote images for better optimisations
|
||||
cacheRemote = false
|
||||
# Image resizing and optimisation
|
||||
optimise = false
|
||||
|
||||
# FixIt 0.3.12 | NEW Custom partials config
|
||||
# Custom partials must be stored in the /layouts/partials/ directory.
|
||||
@@ -1006,6 +1016,8 @@ enableEmoji = true
|
||||
linkToEdit = true
|
||||
# FixIt 0.3.0 | NEW whether to show link to report issue for the post
|
||||
linkToReport = true
|
||||
# FixIt 0.3.20 | NEW whether to show link to view the post in VSCode
|
||||
linkToVscode = true
|
||||
# FixIt 0.3.10 | CHANGED Page style ["narrow", "normal", "wide", ...]
|
||||
pageStyle = "normal"
|
||||
# FixIt 0.2.17 | CHANGED Auto Bookmark Support
|
||||
@@ -1068,19 +1080,41 @@ enableEmoji = true
|
||||
h4 = "{h2}.{h3}.{h4} {title}"
|
||||
h5 = "{h2}.{h3}.{h4}.{h5} {title}"
|
||||
h6 = "{h2}.{h3}.{h4}.{h5}.{h6} {title}"
|
||||
# FixIt 0.2.16 | CHANGED KaTeX mathematical formulas (https://katex.org)
|
||||
# FixIt 0.4.0 | CHANGED mathematical formulas configuration
|
||||
# See http://fixit.lruihao.cn/documentation/content-management/markdown-syntax/extended/#formula
|
||||
[params.page.math]
|
||||
enable = true
|
||||
# default inline delimiter is $ ... $ and \( ... \)
|
||||
inlineLeftDelimiter = ""
|
||||
inlineRightDelimiter = ""
|
||||
# default block delimiter is $$ ... $$, \[ ... \], \begin{equation} ... \end{equation} and some other functions
|
||||
blockLeftDelimiter = ""
|
||||
blockRightDelimiter = ""
|
||||
# KaTeX extension copy_tex
|
||||
copyTex = true
|
||||
# KaTeX extension mhchem
|
||||
mhchem = true
|
||||
# mathematical formulas rendering engines, optional values: ["katex", "mathjax"]
|
||||
type = "katex"
|
||||
# KaTeX server-side rendering (https://katex.org)
|
||||
# KaTeX partial config: https://gohugo.io/functions/transform/tomath/#options
|
||||
[params.page.math.katex]
|
||||
# KaTeX extension copy-tex
|
||||
copyTex = true
|
||||
throwOnError = false
|
||||
errorColor = "#ff4949"
|
||||
# custom macros map
|
||||
# syntax: <macro> = <definition>
|
||||
[params.page.math.katex.macros]
|
||||
# "\\f" = "#1f(#2)" # usage: $\f{a}{b}$
|
||||
# MathJax server-side rendering (https://www.mathjax.org)
|
||||
# MathJax config: https://docs.mathjax.org/en/latest/options/index.html
|
||||
[params.page.math.mathjax]
|
||||
cdn = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
|
||||
[params.page.math.mathjax.packages]
|
||||
# "[+]" = ["configmacros"]
|
||||
# custom macros map
|
||||
# syntax: <macro> = <definition>
|
||||
[params.page.math.mathjax.macros]
|
||||
# "bold" = ["{\\bf #1}", 1] # usage: $\bold{math}$
|
||||
[params.page.math.mathjax.loader]
|
||||
load = ["ui/safe"]
|
||||
[params.page.math.mathjax.loader.paths]
|
||||
# custom = "https://cdn.jsdelivr.net/gh/sonoisa/XyJax-v3@3.0.1/build/"
|
||||
# more loader config e.g source, dependencies, provides etc.
|
||||
[params.page.math.mathjax.options]
|
||||
enableMenu = true
|
||||
# more options config e.g. skipHtmlTags, ignoreHtmlClass etc.
|
||||
# Code wrapper config
|
||||
[params.page.code]
|
||||
# FixIt 0.3.9 | NEW whether to enable the code wrapper
|
||||
@@ -1107,15 +1141,12 @@ enableEmoji = true
|
||||
scale = true
|
||||
# whether to add FullscreenControl
|
||||
fullscreen = true
|
||||
# FixIt 0.3.0 | NEW [Experimental] cache remote images locally, see: https://github.com/hugo-fixit/FixIt/pull/362
|
||||
[params.page.cacheRemoteImages]
|
||||
enable = false
|
||||
# replace remote image url with local image url (place in public/images/remote/)
|
||||
replace = false
|
||||
# FixIt 0.3.0 | NEW Related content config (https://gohugo.io/content-management/related/)
|
||||
[params.page.related]
|
||||
enable = false
|
||||
count = 5
|
||||
# FixIt 0.3.20 | NEW position of related content, optional values: ["aside", "footer"]
|
||||
position = ["aside", "footer"]
|
||||
# FixIt 0.2.17 | NEW Donate (Sponsor) settings
|
||||
[params.page.reward]
|
||||
enable = false
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Markdown anzeigen"
|
||||
viewSource = "Quelle anzeigen"
|
||||
editThisPage = "Diese Seite bearbeiten"
|
||||
reportIssue = "Problem melden"
|
||||
openInEditor = "Im Editor öffnen"
|
||||
back = "Zurück"
|
||||
home = "Startseite"
|
||||
readMore = "Mehr lesen"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Read Markdown"
|
||||
viewSource = "View source"
|
||||
editThisPage = "Edit this page"
|
||||
reportIssue = "Report issue"
|
||||
openInEditor = "Open in editor"
|
||||
back = "Back"
|
||||
home = "Home"
|
||||
readMore = "Read More"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Leer Markdown"
|
||||
viewSource = "Ver fuente"
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = "Reportar problema"
|
||||
openInEditor = "Abrir en el editor"
|
||||
back = "Regresar"
|
||||
home = "Inicio"
|
||||
readMore = "Leer más"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Ouvrir le Markdown"
|
||||
viewSource = "Voir la source"
|
||||
editThisPage = "Modifier cette page"
|
||||
reportIssue = "Signaler un problème"
|
||||
openInEditor = "Ouvrir dans l'éditeur"
|
||||
back = "Retour"
|
||||
home = "Accueil"
|
||||
readMore = "En savoir plus"
|
||||
|
||||
@@ -124,6 +124,7 @@ readMarkdown = "मार्कडाउन पढ़ें"
|
||||
viewSource = "स्रोत देखें"
|
||||
editThisPage = "इस पृष्ठ को संपादित करें"
|
||||
reportIssue = "समस्या की रिपोर्ट करें"
|
||||
openInEditor = "संपादक में खोलें"
|
||||
back = "पीछे"
|
||||
home = "घर"
|
||||
readMore = "और पढ़ें"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Leggi Markdown"
|
||||
viewSource = "Visualizza sorgente"
|
||||
editThisPage = "Modifica questa pagina"
|
||||
reportIssue = "Segnala un problema"
|
||||
openInEditor = "Apri nell'editor"
|
||||
back = "Indietro"
|
||||
home = "Home"
|
||||
readMore = "Leggi di più"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Zobacz Markdown"
|
||||
viewSource = "Zobacz źródło"
|
||||
editThisPage = "Edytuj tą stronę"
|
||||
reportIssue = "Zgłoś problem"
|
||||
openInEditor = "Otwórz w edytorze"
|
||||
back = "Wstecz"
|
||||
home = "Strona główna"
|
||||
readMore = "Czytaj więcej"
|
||||
|
||||
@@ -124,6 +124,7 @@ readMarkdown = "Leia em Markdown"
|
||||
viewSource = "Ver a fonte"
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = "Reportar problema"
|
||||
openInEditor = "Abrir no editor"
|
||||
back = "Voltar"
|
||||
home = "Home"
|
||||
readMore = "Leia mais"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Citire Markdown"
|
||||
viewSource = "Vezi sursa"
|
||||
editThisPage = "Editați această pagină"
|
||||
reportIssue = "Raportează o problemă"
|
||||
openInEditor = "Deschide în editor"
|
||||
back = "Înapoi"
|
||||
home = "Acasă"
|
||||
readMore = "Citește mai mult"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Читать Markdown"
|
||||
viewSource = "Просмотреть источник"
|
||||
editThisPage = "Редактировать эту страницу"
|
||||
reportIssue = "Сообщить о проблеме"
|
||||
openInEditor = "Открыть в редакторе"
|
||||
back = "Назад"
|
||||
home = "Домой"
|
||||
readMore = "Читать больше"
|
||||
|
||||
@@ -123,6 +123,7 @@ readMarkdown = "Читај Markdown"
|
||||
viewSource = "Погледај извор"
|
||||
editThisPage = "Уреди ову страницу"
|
||||
reportIssue = "Пријави проблем"
|
||||
openInEditor = "Отвори у уреднику"
|
||||
back = "Назад"
|
||||
home = "Почетна"
|
||||
readMore = "Прочитај више"
|
||||
|
||||
@@ -122,6 +122,7 @@ readMarkdown = "Đọc với định dạng Markdown"
|
||||
viewSource = "Xem mã nguồn"
|
||||
editThisPage = "Chỉnh sửa trang này"
|
||||
reportIssue = "Báo cáo lỗi"
|
||||
openInEditor = "Mở trong trình chỉnh sửa"
|
||||
back = "Quay lại"
|
||||
home = "Trang chủ"
|
||||
readMore = "Đọc thêm"
|
||||
|
||||
@@ -121,6 +121,7 @@ readMarkdown = "阅读原始文档"
|
||||
viewSource = "查看源码"
|
||||
editThisPage = "编辑此页"
|
||||
reportIssue = "报告问题"
|
||||
openInEditor = "在编辑器中打开"
|
||||
back = "返回"
|
||||
home = "主页"
|
||||
readMore = "阅读全文"
|
||||
|
||||
@@ -121,6 +121,7 @@ readMarkdown = "閱讀原始文檔"
|
||||
viewSource = "查看原始碼"
|
||||
editThisPage = "編輯此頁"
|
||||
reportIssue = "報告問題"
|
||||
openInEditor = "在編輯器中打開"
|
||||
back = "返回"
|
||||
home = "主頁"
|
||||
readMore = "閱讀全文"
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/echarts.html" -}}
|
||||
{{- .Page.Store.Set "hasEcharts" true -}}
|
||||
@@ -1 +0,0 @@
|
||||
{{- dict "Options" .Attributes "Inner" .Inner | partial "plugin/timeline.html" -}}
|
||||
@@ -1,14 +0,0 @@
|
||||
{{- /* TODO refactor */ -}}
|
||||
{{- $params := .Page.Params | merge site.Params.page -}}
|
||||
{{- if .Title | and .Text -}}
|
||||
{{- $linked := ne $params.lightgallery false -}}
|
||||
<figure>
|
||||
{{- dict "Src" .Destination "Alt" .Text "Caption" .Text "Title" .Title "Linked" $linked "Responsive" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- .Text | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}}
|
||||
{{- dict "Src" .Destination "Alt" .Text "Title" .Title "Linked" $linked "Responsive" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
@@ -1,13 +0,0 @@
|
||||
# {{ .Site.Title }}
|
||||
|
||||
{{ $pages := .Scratch.Get "mainSectionPages" -}}
|
||||
{{- $pages = where $pages "Draft" "eq" false -}}
|
||||
{{- T "section.archiveCounter" (len $pages) }}
|
||||
{{ range $pages.GroupByPublishDate "2006" }}
|
||||
{{- if ne .Key "0001" -}}
|
||||
{{- printf "\n## %v\n\n%v\n\n" .Key (T "section.archiveCounter" .Pages.Len) -}}
|
||||
{{- range .Pages -}}
|
||||
{{- printf "- %v [%v](%v \"%v\")\n" (.PublishDate.Format "01-02") .Title .Permalink (.PublishDate.Format "2006-01-02 15:04:05") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,8 @@
|
||||
{{- dict
|
||||
"Options" .Attributes
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/echarts.html"
|
||||
-}}
|
||||
{{- .Page.Store.Set "hasEcharts" true -}}
|
||||
@@ -0,0 +1,7 @@
|
||||
{{- dict
|
||||
"Options" .Attributes
|
||||
"Inner" .Inner
|
||||
"Resources" .Page.Resources
|
||||
"Position" .Position
|
||||
| partial "plugin/timeline.html"
|
||||
-}}
|
||||
@@ -7,7 +7,8 @@
|
||||
{{- end -}}
|
||||
{{- $headingConfig := $params.heading -}}
|
||||
{{- /* Only enable in main section pages */ -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection (eq .Page.Type "posts") true -}}
|
||||
{{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}}
|
||||
{{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}}
|
||||
{{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}}
|
||||
{{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}}
|
||||
@@ -28,18 +29,30 @@
|
||||
|
||||
{{- if $ordered -}}
|
||||
{{- /* Set the count for child level to 0 */ -}}
|
||||
{{- .Page.Scratch.SetInMap "heading-counter" (string (add $level 1)) 0 -}}
|
||||
{{- .Page.Store.SetInMap "heading-counter" (string (add $level 1)) 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $attrs := "" }}
|
||||
{{- range $key, $value := .Attributes }}
|
||||
{{- $attrs = printf "%s %s=%q" $attrs $key $value }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Attributes.class }}
|
||||
{{- $attrs = replace $attrs . (printf "heading-element %s" .) }}
|
||||
{{- else }}
|
||||
{{- $attrs = printf "class=%q %s" "heading-element" $attrs }}
|
||||
{{- end }}
|
||||
{{- $attrs = partial "function/trim.html" $attrs -}}
|
||||
|
||||
{{- /* Force decrease the markup level to avoid multiple h1 */ -}}
|
||||
{{- $markupLevel := cond (gt $maxMarkupLevel $level) $maxMarkupLevel $level -}}
|
||||
<h{{ $markupLevel }} id="{{ .Anchor | safeURL }}" class="heading-element">
|
||||
<h{{ $markupLevel }} {{ $attrs | safeHTMLAttr }}>
|
||||
{{- $title := .Text -}}
|
||||
{{- if $ordered -}}
|
||||
{{- /* Add 1 to the current level */ -}}
|
||||
{{- $headingMap := .Page.Scratch.Get "heading-counter" -}}
|
||||
{{- $headingMap := .Page.Store.Get "heading-counter" -}}
|
||||
{{- $count := (string $level) | index $headingMap | int | add 1 -}}
|
||||
{{- .Page.Scratch.SetInMap "heading-counter" (string $level) $count -}}
|
||||
{{- .Page.Store.SetInMap "heading-counter" (string $level) $count -}}
|
||||
|
||||
{{- /* Get the counters for all levels */ -}}
|
||||
{{- $h1 := "1" | index $headingMap | int | string -}}
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- /*
|
||||
A Markdown image has three components: the image description, the image destination, and optionally the image title.
|
||||
|
||||

|
||||
------------ ------------------ ---------
|
||||
description destination title
|
||||
------------ ------------------ ---------
|
||||
.Text .Destination .Title
|
||||
*/ -}}
|
||||
{{- $params := .Page.Params | merge site.Params.page -}}
|
||||
{{- $optim := slice
|
||||
(dict "Process" "resize 800x webp q75" "descriptor" "800w")
|
||||
(dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
|
||||
(dict "Process" "resize 1600x webp q75" "descriptor" "1600w")
|
||||
-}}
|
||||
{{- if .Title | and .Text -}}
|
||||
{{- $linked := ne $params.lightgallery false -}}
|
||||
<figure>
|
||||
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- .Title | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}}
|
||||
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{- $params := .Page.Params | merge site.Params.page -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- if eq $math true -}}
|
||||
{{- $math = dict "enable" true | merge site.Params.page.math -}}
|
||||
{{- else if eq $math false -}}
|
||||
{{- $math = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /*
|
||||
Mathematical formulas rendering:
|
||||
- KaTeX server-side rendering
|
||||
- MathJax client-side rendering
|
||||
Regular passthrough rendering:
|
||||
- [todo] support more features in future
|
||||
*/ -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- if eq $math.type "katex" -}}
|
||||
{{- $katex := $math.katex -}}
|
||||
{{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block") }}
|
||||
{{- $opts = dict "throwOnError" $katex.throwOnError "errorColor" $katex.errorColor | merge $opts }}
|
||||
{{- $macros := $katex.macros | default dict -}}
|
||||
{{- if $macros -}}
|
||||
{{- $opts = dict "macros" $macros | merge $opts -}}
|
||||
{{- end -}}
|
||||
{{- /* render mathematical markup to HTML */ -}}
|
||||
{{- with try (transform.ToMath .Inner $opts) }}
|
||||
{{- with .Err }}
|
||||
{{- errorf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s: see %s." . $.Position }}
|
||||
{{- else }}
|
||||
{{- .Value }}
|
||||
{{- $.Page.Store.Set "hasKaTeX" true -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- else if eq $math.type "mathjax" -}}
|
||||
{{- if eq $.Type "block" -}}
|
||||
$${{- .Inner -}}$$
|
||||
{{- else -}}
|
||||
${{ .Inner }}$
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- /* Regular passthrough rendering */ -}}
|
||||
{{- /* waiting for Hugo interface to get delimiters */ -}}
|
||||
{{- .Inner -}}
|
||||
{{- end -}}
|
||||
@@ -1,26 +1,27 @@
|
||||
{{- $noop := .WordCount -}}
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $config := (.Scratch.Get "this").config -}}
|
||||
{{- $config = dict "version" (.Scratch.Get "version") | merge $config -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $config := (.Store.Get "this").config -}}
|
||||
{{- $config = dict "version" (hugo.Store.Get "version") | merge $config -}}
|
||||
|
||||
{{- /* Search */ -}}
|
||||
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
|
||||
{{- $search := .Site.Params.search -}}
|
||||
{{- /* TODO update "lib/autocomplete-js/umd/index.production.js" */ -}}
|
||||
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") | dict "search" | merge $config -}}
|
||||
{{- if eq $search.type "algolia" -}}
|
||||
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
|
||||
{{- else if eq $search.type "fuse" -}}
|
||||
{{- with .Site.Home.OutputFormats.Get "search" -}}
|
||||
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $source := $cdn.fuseJS | default "lib/fuse/fuse.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}}
|
||||
{{- else if eq $search.type "cse" -}}
|
||||
{{- $config = dict "type" "cse" | dict "search" | merge $config -}}
|
||||
@@ -40,26 +41,26 @@
|
||||
{{- /* instant.page */ -}}
|
||||
{{- if $params.instantPage -}}
|
||||
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* twemoji */ -}}
|
||||
{{- if $params.twemoji -}}
|
||||
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "twemoji" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lightgallery */ -}}
|
||||
{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "lightgallery" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -78,51 +79,53 @@
|
||||
{{- /* Sharer.js */ -}}
|
||||
{{- if $params.share.enable -}}
|
||||
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* TypeIt */ -}}
|
||||
{{- if .Store.Get "hasTyped" -}}
|
||||
{{- $typeit := .Site.Params.typeit -}}
|
||||
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop | dict "typeit" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- $math := .Scratch.Get "math" -}}
|
||||
{{- /* Mathematical formulas */ -}}
|
||||
{{- $math := .Store.Get "math" -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- if $math.copyTex -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- if (eq $math.type "katex") | and (.Store.Get "hasKaTeX") -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- /* Copy-tex extension */ -}}
|
||||
{{- if $math.katex.copyTex -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $math.mhchem -}}
|
||||
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* MathJax */ -}}
|
||||
{{- if eq $math.type "mathjax" -}}
|
||||
{{/* TODO improve MathJax setup. e.g. content encryption, Twikoo math etc. */}}
|
||||
{{- $mathjax := $math.mathjax -}}
|
||||
{{- $source := "js/lib/load-mathjax.js" -}}
|
||||
{{- $options := dict "targetPath" "js/lib/load-mathjax.min.js" "minify" hugo.IsProduction -}}
|
||||
{{- $mathjaxOpts := $mathjax.options | default dict -}}
|
||||
{{- $mathjaxOpts = dict "enableMenu" $mathjaxOpts.enablemenu | merge $mathjaxOpts -}}
|
||||
{{- $params := dict
|
||||
"cdn" $mathjax.cdn
|
||||
"tex" ($mathjax.tex | default dict)
|
||||
"packages" ($mathjax.packages | default dict)
|
||||
"macros" ($mathjax.macros | default dict)
|
||||
"loader" ($mathjax.loader | default dict)
|
||||
"options" $mathjaxOpts
|
||||
-}}
|
||||
{{- $options = dict "params" $params | merge $options -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" $source "Build" $options "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation}" "right" "\\end{equation}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{equation*}" "right" "\\end{equation*}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align}" "right" "\\end{align}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{align*}" "right" "\\end{align*}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat}" "right" "\\end{alignat}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{alignat*}" "right" "\\end{alignat*}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{gather}" "right" "\\end{gather}" "display" true) -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "\\begin{CD}" "right" "\\end{CD}" "display" true) -}}
|
||||
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
|
||||
{{- end -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "$" "right" "$" "display" false) (dict "left" "\\(" "right" "\\)" "display" false) -}}
|
||||
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
|
||||
{{- end -}}
|
||||
{{- $config = dict "strict" false "delimiters" $delimiters | dict "math" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* mermaid */ -}}
|
||||
@@ -140,7 +143,7 @@
|
||||
{{- /* ECharts */ -}}
|
||||
{{- if .Store.Get "hasEcharts" -}}
|
||||
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $lightTheme := resources.Get "lib/echarts/theme/light.yml" | transform.Unmarshal -}}
|
||||
{{- $darkTheme := resources.Get "lib/echarts/theme/dark.yml" | transform.Unmarshal -}}
|
||||
{{- $config = dict "lightTheme" $lightTheme "darkTheme" $darkTheme | dict "echarts" | merge $config -}}
|
||||
@@ -149,10 +152,10 @@
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if .HasShortcode "mapbox" -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -160,23 +163,23 @@
|
||||
{{- if .HasShortcode "music" -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
|
||||
{{- /* MetingJS */ -}}
|
||||
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Cookie Consent */ -}}
|
||||
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
|
||||
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
|
||||
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
|
||||
{{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "assets.cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "assets.cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "assets.cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
|
||||
@@ -186,14 +189,14 @@
|
||||
{{- /* PanguJS */ -}}
|
||||
{{- if eq .Site.Params.pangu.enable true -}}
|
||||
{{- $source := $cdn.panguJS | default "lib/pangu/pangu.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "pangu" .Site.Params.pangu | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Watermark */ -}}
|
||||
{{- if eq .Site.Params.watermark.enable true -}}
|
||||
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- /* Hugo bug: case insensitive for `.Site.Params` */ -}}
|
||||
{{- $config = dict "watermark" .Site.Params.watermark | merge $config -}}
|
||||
{{- end -}}
|
||||
@@ -205,27 +208,27 @@
|
||||
{{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
|
||||
{{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}}
|
||||
{{- $xxhashWasmJS := $cdn.xxhashWasmJS | default "lib/xxhash-wasm/xxhash-wasm.js" -}}
|
||||
{{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $xxhashWasmJS "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- dict "Source" $xxhashWasmJS "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- /* Decryption script */ -}}
|
||||
{{- $options := dict "targetPath" "js/fixit-decryptor.min.js" "minify" hugo.IsProduction -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" (resources.Get "js/fixit-decryptor.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" (resources.Get "js/fixit-decryptor.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 不蒜子 */ -}}
|
||||
{{- if .Site.Params.busuanzi.enable | and hugo.IsProduction -}}
|
||||
{{- $source := .Site.Params.busuanzi.source | default "https://vercount.one/js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Site creation time */ -}}
|
||||
{{- $siteTime := .Scratch.Get "siteTime" -}}
|
||||
{{- $siteTime := .Site.Store.Get "siteTime" -}}
|
||||
{{- if $siteTime.enable -}}
|
||||
{{- with $siteTime.value -}}
|
||||
{{- $config = dict "siteTime" . | merge $config -}}
|
||||
@@ -259,11 +262,11 @@
|
||||
{{- $paceCSS = printf "%v/pace-theme-default.min.css" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
{{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- /* To patch pace theme flat-top z-index error */ -}}
|
||||
{{- if eq $.Site.Params.pace.theme "flat-top" -}}
|
||||
{{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -271,18 +274,18 @@
|
||||
{{- partial "plugin/post-chat-ai.html" . -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "store/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Store.Get "styleArr" -}}
|
||||
{{- $content := delimit . " " -}}
|
||||
{{- $path := substr (md5 $.RelPermalink) 0 8 | printf "css/%v" -}}
|
||||
{{- $options := printf "%v.min.css" $path | dict "targetPath" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Page" $ "Data" | partial "store/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Config script */ -}}
|
||||
@@ -290,14 +293,14 @@
|
||||
{{- if hugo.IsServer -}}
|
||||
{{- $configJS = add $configJS "console.log('Page config:', window.config);" -}}
|
||||
{{- end -}}
|
||||
{{- $configJS | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $configJS | dict "Content" | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- $options := dict "targetPath" "js/theme.min.js" "minify" hugo.IsProduction -}}
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "external" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" (resources.Get "js/theme.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" (resources.Get "js/theme.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||
|
||||
{{- /* Custom Assets */ -}}
|
||||
{{- block "custom-assets" . }}{{ end -}}
|
||||
@@ -308,20 +311,20 @@
|
||||
{{- if not hugo.IsProduction -}}
|
||||
{{- $options = dict "sourceMap" "inline" | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Store.Get "scriptArr" -}}
|
||||
{{- $content := delimit . "\n" -}}
|
||||
{{- $targetPath := substr (md5 $.RelPermalink) 0 8 | printf "js/%v.js" -}}
|
||||
{{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").style -}}
|
||||
{{- range (.Store.Get "this").style -}}
|
||||
{{- partial "plugin/style.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").script -}}
|
||||
{{- range (.Store.Get "this").script -}}
|
||||
{{- partial "plugin/script.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<userId>{{ .Site.Params.feed.follow.userId }}</userId>
|
||||
</follow_challenge>
|
||||
{{- end }}
|
||||
<generator>Hugo {{ hugo.Version }} & FixIt {{ .Version }}</generator>
|
||||
<generator>Hugo {{ hugo.Version }} & FixIt {{ hugo.Store.Get "version" }}</generator>
|
||||
<language>{{ .Site.Language.LanguageCode }}</language>{{ with .Site.Params.author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Params.author.email }}
|
||||
<webMaster>{{ . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||
@@ -32,13 +32,9 @@
|
||||
{{- $params := .Params | merge .Site.Params.Page }}
|
||||
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }}
|
||||
{{- $author := partial "function/get-author-map.html" .Params.author }}
|
||||
{{- $cacheRemoteImages := $params.cacheRemoteImages }}
|
||||
{{- $image := $params.featuredimagepreview | default $params.featuredimage }}
|
||||
{{- with dict "Path" $image "Resources" .Resources "CacheRemoteImages" $cacheRemoteImages.enable | partial "function/resource.html" }}
|
||||
{{- $url := urls.Parse $image }}
|
||||
{{- if not $url.Host | or $cacheRemoteImages.replace }}
|
||||
{{- $image = .Permalink }}
|
||||
{{- end }}
|
||||
{{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" }}
|
||||
{{- $image = .Permalink }}
|
||||
{{- end }}
|
||||
{{- with .Resources.GetMatch "featured-image" }}
|
||||
{{- $image = .Permalink }}
|
||||
@@ -10,7 +10,7 @@
|
||||
{{- if ne $footerConfig.powered.enable false -}}
|
||||
<div class="footer-line powered{{ with $footerConfig.order.powered }} order-{{ . }}{{ end }}">
|
||||
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer" title="Hugo %v">{hugoLogo}Hugo</a>` hugo.Version -}}
|
||||
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (.Scratch.Get "version") -}}
|
||||
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (hugo.Store.Get "version") -}}
|
||||
{{- if $footerConfig.powered.hugoLogo -}}
|
||||
{{- $hugoLogo := printf `<img class="hugo-icon" src="%v" alt="Hugo logo" /> ` (resources.Get "images/hugo.svg" | minify).RelPermalink -}}
|
||||
{{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}}
|
||||
@@ -42,7 +42,7 @@
|
||||
{{- /* Author */ -}}
|
||||
{{- if ne $footerConfig.author false -}}
|
||||
<span class="author" itemprop="copyrightHolder">
|
||||
{{ partial "plugin/link.html" (dict "Destination" ($.Site.Params.author.link | default (.Scratch.Get "homeRelPermalink")) "Content" .Site.Params.author.name) -}}
|
||||
{{ partial "plugin/link.html" (dict "Destination" ($.Site.Params.author.link | default (.Site.Store.Get "homeRelPermalink")) "Content" .Site.Params.author.name) -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- $siteTime := .Scratch.Get "siteTime" -}}
|
||||
{{- $siteTime := .Site.Store.Get "siteTime" -}}
|
||||
{{- if $siteTime.enable -}}
|
||||
<div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}">
|
||||
{{- if $siteTime.enable | and $siteTime.value -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- /*
|
||||
Format a number with a specific precision and add 'k' if it's greater than 1000
|
||||
Usage: {{ partial "function/format-number" (dict "PRECISION" 2 "NUMBER" 5201314) }}
|
||||
Example Output: 19980.52k
|
||||
*/ -}}
|
||||
|
||||
{{- $number := .NUMBER -}}
|
||||
{{- $precision := .PRECISION | default 1 -}}
|
||||
{{- with $number -}}
|
||||
{{- if ge . 1000 -}}
|
||||
{{- $fmtNum := lang.FormatNumberCustom $precision (div . 1000.0) "- ." -}}
|
||||
{{- $fmtNum = $fmtNum | strings.TrimSuffix "0" | strings.TrimSuffix "." -}}
|
||||
{{- $number = printf "%vk" $fmtNum -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $number -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- /* cache remote image locally */ -}}
|
||||
{{- $resource := 0 -}}
|
||||
{{- $isRemote := urls.Parse .Src | partial "function/is-url-remote.html" -}}
|
||||
|
||||
{{- if $isRemote -}}
|
||||
{{- with try (resources.GetRemote .Src) -}}
|
||||
{{- with .Err -}}
|
||||
{{- warnf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- if .ResourceType | eq "image" -}}
|
||||
{{- /* placed remote image in public/images/remote/ */ -}}
|
||||
{{- $resource = . | resources.Copy (add "/images/remote/" .Name) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Unable to get remote image %q" $.Src -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $resource -}}
|
||||
@@ -1,11 +1,12 @@
|
||||
{{- /* ID */ -}}
|
||||
{{- $noop := .Page.WordCount -}}
|
||||
{{- $id := "" -}}
|
||||
{{- with .Id -}}
|
||||
{{- /* If an ID is specified, then just use it.*/ -}}
|
||||
{{- $id = printf "%v" . -}}
|
||||
{{- else -}}
|
||||
{{- $count := ($.Scratch.Get "this").count | default 1 -}}
|
||||
{{- $count := ($.Page.Store.Get "this").count | default 1 -}}
|
||||
{{- $id = printf "id-%d" $count -}}
|
||||
{{- $count | add 1 | $.Scratch.SetInMap "this" "count" -}}
|
||||
{{- $count | add 1 | $.Page.Store.SetInMap "this" "count" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
||||
@@ -0,0 +1 @@
|
||||
{{- return and (not (eq .Scheme "")) .Host -}}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $Resources := .Resources | default page.Resources -}}
|
||||
{{- $resource := 0 -}}
|
||||
{{- $url := urls.Parse .Path -}}
|
||||
{{- if not (partial "function/is-url-remote.html" $url) -}}
|
||||
{{- $dest := strings.TrimPrefix "./" $url.Path -}}
|
||||
{{- if $Resources -}}
|
||||
{{- with $Resources.GetMatch $dest -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $resource -}}
|
||||
{{- with resources.Get $dest -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $resource -}}
|
||||
+5
@@ -1,3 +1,8 @@
|
||||
{{- /*
|
||||
Example:
|
||||
{{- $suffixList := slice ".jpeg" ".jpg" ".png" ".gif" ".bmp" ".tif" ".tiff" ".webp" ".avif" ".svg" -}}
|
||||
{{- $suffixValid := (dict "Path" .Path "Suffixes" $suffixList | partial "function/suffix-validation.html") -}}
|
||||
*/ -}}
|
||||
{{- $url := urls.Parse .Path -}}
|
||||
{{- $path := path.Clean ((printf "%v%v" $url.Host $url.Path) | lower) -}}
|
||||
{{- with $url.Scheme -}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- /* Trim whitespace from the beginning and end of a string */ -}}
|
||||
{{- return (. | replaceRE `[\s]+` " " | strings.TrimSpace) -}}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}}
|
||||
{{- if .IsHome -}}
|
||||
{{- $title = site.Title -}}
|
||||
@@ -37,39 +37,6 @@
|
||||
<link rel="alternate" type="application/feed+json" href="{{ .Permalink }}" title="{{ $title }}" />
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mastodon Validation for the site */ -}}
|
||||
{{- with .Site.Params.social.Mastodon -}}
|
||||
{{- $mastodonConfig := . -}}
|
||||
{{- $id := "" -}}
|
||||
{{- $prefix := "https://mastodon.social/" -}}
|
||||
|
||||
{{- /* Check if Mastodon is a string */ -}}
|
||||
{{- if printf "%T" $mastodonConfig | eq "string" -}}
|
||||
{{- $id = strings.TrimPrefix "@" $mastodonConfig -}}
|
||||
|
||||
{{- /* Check if Mastodon is a map/object */ -}}
|
||||
{{- else if printf "%T" $mastodonConfig | eq "map[string]interface {}" -}}
|
||||
{{- $id = .Id | default .id | default "" | strings.TrimPrefix "@" -}}
|
||||
{{- $prefix = .Prefix | default .prefix | default $prefix -}}
|
||||
|
||||
{{- /* If it's neither a string nor a map, do nothing */ -}}
|
||||
{{- else -}}
|
||||
{{- errorf "Invalid Mastodon configuration: %#v" $mastodonConfig -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Remove trailing slash from prefix */ -}}
|
||||
{{- $prefix = strings.TrimSuffix "/" $prefix -}}
|
||||
|
||||
{{- /* Construct profile URL */ -}}
|
||||
{{- $profileUrl := printf "%s/@%s" $prefix $id -}}
|
||||
|
||||
{{- /* Only proceed if we have a valid ID */ -}}
|
||||
{{- if $id -}}
|
||||
<link rel="me" href="{{ $profileUrl }}" />
|
||||
<meta name="fediverse:creator" content="{{ $id }}@{{ (urls.Parse $prefix).Host }}" />
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $options := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $toCSS := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
@@ -36,3 +36,19 @@
|
||||
{{- with .Site.Params.app.tileColor -}}
|
||||
<meta name="msapplication-TileColor" content="{{ . }}">
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mastodon Validation for the site */ -}}
|
||||
{{- with .Site.Params.social.Mastodon -}}
|
||||
{{- $id := "" -}}
|
||||
{{- $prefix := "https://mastodon.social/" -}}
|
||||
{{- if reflect.IsMap . -}}
|
||||
{{- $id = .Id | default .id -}}
|
||||
{{- $prefix = .Prefix | default .prefix | default $prefix -}}
|
||||
{{- end -}}
|
||||
{{- if $id | and $prefix -}}
|
||||
{{- $link := printf "%s/%s" $prefix $id -}}
|
||||
{{- $email := printf "%s@%s" (strings.TrimPrefix "@" $id) (urls.Parse $prefix).Host -}}
|
||||
<link rel="me" href="{{ $link }}" />
|
||||
<meta name="fediverse:creator" content="{{ $email }}" />
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
|
||||
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
{{- $options := dict "targetPath" "js/head/color-scheme.min.js" "minify" hugo.IsProduction -}}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- $buildDrafts := .Site.BuildDrafts -}}
|
||||
{{- $homeRelPermalink := .Scratch.Get "homeRelPermalink" -}}
|
||||
{{- $homeRelPermalink := .Site.Store.Get "homeRelPermalink" -}}
|
||||
|
||||
{{- /* Desktop header */ -}}
|
||||
<header class="desktop animate__faster" id="header-desktop">
|
||||
@@ -8,7 +8,7 @@
|
||||
<a href="{{ $homeRelPermalink }}" title="{{ .Site.Title }}">
|
||||
{{- with .Site.Params.header.title -}}
|
||||
{{- with .logo -}}
|
||||
{{- dict "Src" . "Class" "logo" "Alt" $.Site.Title "Width" 26 "Height" 26 | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" . "Class" "logo" "Alt" $.Site.Title "Width" 32 "Height" 32 | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
{{- with .pre -}}
|
||||
<span class="header-title-pre">{{ . | safeHTML }}</span>
|
||||
@@ -14,6 +14,11 @@
|
||||
{{- if $avatar -}}
|
||||
<div class="home-avatar">
|
||||
{{- $menus := $.Site.Menus.main | default slice -}}
|
||||
{{- $optim := slice
|
||||
(dict "Process" "fill center 96x96 webp q75" "descriptor" "96w")
|
||||
(dict "Process" "fill center 144x144 webp q75" "descriptor" "144w")
|
||||
(dict "Process" "fill center 192x192 webp q75" "descriptor" "192w")
|
||||
-}}
|
||||
{{- $avatarMenuIndex := 0 -}}
|
||||
{{- if $profile.avatarMenu -}}
|
||||
{{- range $index, $menu := $menus -}}
|
||||
@@ -28,10 +33,10 @@
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
|
||||
{{- dict "Src" $avatar "Alt" $.Site.Params.author.name "Width" 96 "Height" 96 | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $avatar "Alt" "Home avatar" "Width" 96 "Height" 96 "OptimConfig" $optim | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{- dict "Src" $avatar "Alt" $.Site.Params.author.name "Width" 96 "Height" 96 | partial "plugin/image.html" -}}
|
||||
{{- dict "Src" $avatar "Alt" "Home avatar" "Width" 96 "Height" 96 "OptimConfig" $optim | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -84,13 +89,23 @@
|
||||
{{- $social = dict "Newtab" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.icon -}}
|
||||
{{- $social = dict "Icon" . | merge $social -}}
|
||||
{{- $icon := dict -}}
|
||||
{{- with .class -}}
|
||||
{{- $icon = dict "Class" . | merge $icon -}}
|
||||
{{- end -}}
|
||||
{{- with .simpleicons -}}
|
||||
{{- $icon = dict "Simpleicons" . | merge $icon -}}
|
||||
{{- end -}}
|
||||
{{- with .src -}}
|
||||
{{- $icon = dict "Src" . | merge $icon -}}
|
||||
{{- end -}}
|
||||
{{- $social = dict "Icon" $icon | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- else if ne $value true -}}
|
||||
{{- $social = dict "Id" $value | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- if $social.Icon.Simpleicons -}}
|
||||
{{- $prefix := ($.Scratch.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $prefix := ($.Site.Store.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- $socialArr = $socialArr | append $social -}}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- /* Deprecated parameter detection */ -}}
|
||||
{{- $warns := slice -}}
|
||||
{{- $errors := slice -}}
|
||||
|
||||
{{- with .Site.Params.ibruce -}}
|
||||
{{- $warns = $warns | append "The parameter `params.ibruce` is deprecated since v0.3.9, use `params.busuanzi` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $warns -}}
|
||||
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (hugo.Store.Get "version") (delimit $warns "\n - ") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $errors -}}
|
||||
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (hugo.Store.Get "version") (delimit $errors "\n - ") -}}
|
||||
{{- end -}}
|
||||
+9
-10
@@ -1,5 +1,4 @@
|
||||
{{- /* FixIt theme environment detection */ -}}
|
||||
|
||||
{{- $params := partial "function/params.html" -}}
|
||||
|
||||
{{- if hugo.IsProduction -}}
|
||||
@@ -12,21 +11,21 @@
|
||||
{{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "cdn" $cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- .Site.Store.Set "cdn" $cdn -}}
|
||||
{{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Site.Store.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Store.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.page.comment -}}
|
||||
{{- .Store.Set "comment" .Site.Params.page.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" (dict "enable" false) -}}
|
||||
{{- .Store.Set "comment" (dict "enable" false) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Scratch.Set "devOpts" .Site.Params.dev -}}
|
||||
{{- .Site.Store.Set "devOpts" .Site.Params.dev -}}
|
||||
{{- if ne .Site.Params.dev.enable true -}}
|
||||
{{- .Scratch.Set "devOpts" dict -}}
|
||||
{{- .Site.Store.Set "devOpts" dict -}}
|
||||
{{- end -}}
|
||||
{{- if eq .Site .Sites.Default -}}
|
||||
{{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "init.devEnvWarn") -}}
|
||||
{{- warnf "FixIt %v\n%v\n\n" (hugo.Store.Get "version") (T "init.devEnvWarn") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
{{- $version := .Scratch.Get "version" -}}
|
||||
{{- $version := hugo.Store.Get "version" -}}
|
||||
{{- $latest := $version -}}
|
||||
{{- $devOpts := .Scratch.Get "devOpts" -}}
|
||||
{{- $devOpts := .Site.Store.Get "devOpts" -}}
|
||||
|
||||
{{- /* Check for updates */ -}}
|
||||
{{- if $devOpts.c4u -}}
|
||||
{{- $url := "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" -}}
|
||||
{{- $options := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
|
||||
{{- $options := dict "headers" (hugo.Store.Get "githubTokenHeader") -}}
|
||||
{{- $latest = (partial "function/get-remote-json" (dict "URL" $url "OPTIONS" $options )).tag_name -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "latest" $latest -}}
|
||||
{{- hugo.Store.Set "latest" $latest -}}
|
||||
@@ -2,15 +2,16 @@
|
||||
{{- $homeRelPermalink := .Site.Home.RelPermalink -}}
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "archives/" $homeRelPermalink -}}
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
|
||||
{{- .Scratch.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
{{- .Site.Store.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
|
||||
{{- /* Set pages of main section */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- .Scratch.Set "mainSectionPages" $pages -}}
|
||||
{{- /* Set pages of main sections */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Section" "in" .Site.MainSections -}}
|
||||
{{- $pages = $pages | union (where .Site.RegularPages "Type" "in" .Site.MainSections) -}}
|
||||
{{- .Site.Store.Set "mainSectionPages" $pages -}}
|
||||
|
||||
{{- /* Select the scope named `public_repo` to generate personal access token */ -}}
|
||||
{{- $header := dict "Authorization" "" -}}
|
||||
{{- with (getenv "HUGO_PARAMS_GHTOKEN") -}}
|
||||
{{- $header = dict "Authorization" (printf "token %v" .) -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "githubTokenHeader" $header -}}
|
||||
{{- hugo.Store.Set "githubTokenHeader" $header -}}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- .Scratch.Set "version" "v0.3.17-8b402129" -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
{{- hugo.Store.Set "version" "v0.4.0-alpha" -}}
|
||||
{{- .Store.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
{{- partial "init/detection-version.html" . -}}
|
||||
@@ -6,7 +6,7 @@
|
||||
{{- if not (reflect.IsMap $toc) -}}
|
||||
{{- $toc = dict "enable" $toc | merge .Site.Params.page.toc -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "toc" $toc -}}
|
||||
{{- .Store.Set "toc" $toc -}}
|
||||
|
||||
{{- /* Reward data patch */ -}}
|
||||
{{- $reward := $params.reward -}}
|
||||
@@ -15,7 +15,7 @@
|
||||
{{- else if eq $reward false -}}
|
||||
{{- $reward = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "reward" $reward -}}
|
||||
{{- .Store.Set "reward" $reward -}}
|
||||
|
||||
{{- /* KaTeX data patch */ -}}
|
||||
{{- $math := $params.math -}}
|
||||
@@ -24,7 +24,7 @@
|
||||
{{- else if eq $math false -}}
|
||||
{{- $math = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "math" $math -}}
|
||||
{{- .Store.Set "math" $math -}}
|
||||
|
||||
{{- /* SiteTime config patch */ -}}
|
||||
{{- $siteTime := dict "Animate" true "Icon" "fa-solid fa-heartbeat" -}}
|
||||
@@ -35,4 +35,4 @@
|
||||
{{- $siteTime = dict "enable" true "value" . | merge $siteTime -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "siteTime" $siteTime -}}
|
||||
{{- .Site.Store.Set "siteTime" $siteTime -}}
|
||||
@@ -1,16 +1,16 @@
|
||||
{{- if gt .Paginator.TotalPages 1 -}}
|
||||
<ul class="pagination">
|
||||
{{- .Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- .Site.Store.Set "paginator.ellipsed" false -}}
|
||||
{{- range $.Paginator.Pagers -}}
|
||||
{{- $right := sub .TotalPages .PageNumber -}}
|
||||
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
||||
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
|
||||
{{- if $showNumber -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" false -}}
|
||||
{{- $.Site.Store.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Site.Store.Set "paginator.shouldEllipse" false -}}
|
||||
{{- else -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" true -}}
|
||||
{{- $.Site.Store.Set "paginator.shouldEllipse" (not ($.Site.Store.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Site.Store.Set "paginator.ellipsed" true -}}
|
||||
{{- end -}}
|
||||
{{- if $showNumber -}}
|
||||
<li class="page-item{{ if eq . $.Paginator }} active{{ end }}">
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="{{ .URL }}">{{ .PageNumber }}</a>
|
||||
</span>
|
||||
</li>
|
||||
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
||||
{{- else if ($.Site.Store.Get "paginator.shouldEllipse") -}}
|
||||
<li class="page-item">
|
||||
<span class="page-link" aria-hidden="true">…</span>
|
||||
</li>
|
||||
@@ -24,7 +24,7 @@
|
||||
{{- else }}
|
||||
{{- $attrs = printf "class=%q %s" (printf "alert alert-%s" $.Type) $attrs }}
|
||||
{{- end }}
|
||||
{{- $attrs = trim $attrs " " -}}
|
||||
{{- $attrs = partial "function/trim.html" $attrs -}}
|
||||
|
||||
<div {{ $attrs | safeHTMLAttr }}>
|
||||
{{- $icon := index $iconMap .Type -}}
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
|
||||
{{- $analytics := .Site.Store.Get "analytics" | default dict -}}
|
||||
|
||||
{{- if $analytics.enable -}}
|
||||
{{- /* Google Analytics */ -}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user