Skip to content

Commit

Permalink
⬆️ Chore(libs): update Twikoo from 1.4.10 to 1.6.8 and add Katex supp…
Browse files Browse the repository at this point in the history
…ort for it (#215 #243)

Closes #215
Closes #243
  • Loading branch information
Lruihao committed Jan 7, 2023
1 parent bd785eb commit b974fa5
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ All notable changes to this project will be documented in this file.
- :globe_with_meridians: Docs(i18n): add missing translations for French + enhancements (@Kapusch[#247](https://github.com/hugo-fixit/FixIt/pull/247))
- :lipstick: Style: refactor css style
- :lipstick: Style: update home page stylesheet
- :arrow_up: Chore(libs):
- Update Twikoo from 1.4.10 to 1.6.8 and add Katex support for it ([#215](https://github.com/hugo-fixit/FixIt/issues/215) [#243](https://github.com/hugo-fixit/FixIt/issues/243))
- :wrench: Chore(deps-dev):
- Bump @babel/cli from 7.18.10 to 7.19.3
- Bump @babel/core from 7.19.1 to 7.19.6
Expand Down
2 changes: 2 additions & 0 deletions assets/data/cdn/jsdelivr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ libFiles:
sharerJS: [email protected]/sharer.min.js
# [email protected] https://github.com/twitter/twemoji
twemojiJS: [email protected]/dist/twemoji.min.js
# [email protected] https://github.com/imaegoo/twikoo
twikooJS: [email protected]/dist/twikoo.all.min.js
# [email protected] https://github.com/alexmacarthur/typeit
typeitJS: [email protected]/dist/index.umd.js
# [email protected] https://github.com/xCss/Valine
Expand Down
2 changes: 2 additions & 0 deletions assets/data/cdn/unpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ libFiles:
sharerJS: [email protected]/sharer.min.js
# [email protected] https://github.com/twitter/twemoji
twemojiJS: [email protected]/dist/twemoji.min.js
# [email protected] https://github.com/imaegoo/twikoo
twikooJS: [email protected]/dist/twikoo.all.min.js
# [email protected] https://github.com/alexmacarthur/typeit
typeitJS: [email protected]/dist/index.umd.js
# [email protected] https://github.com/xCss/Valine
Expand Down
1 change: 1 addition & 0 deletions assets/lib/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ [email protected] https://github.com/vinta/pangu.js
[email protected] https://github.com/ellisonleao/sharer.js
[email protected] https://github.com/simple-icons/simple-icons
[email protected] https://github.com/twitter/twemoji
[email protected] https://github.com/imaegoo/twikoo
[email protected] https://github.com/alexmacarthur/typeit
[email protected] https://github.com/xCss/Valine
[email protected] https://github.com/Tencent/vConsole
Expand Down
2 changes: 1 addition & 1 deletion assets/lib/twikoo/twikoo.all.min.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
editorTravel = true
flatMode = "auto"
maxNesting = 3
# It take effect when `params.page.lightgallery` is enabled
# FixIt 0.2.17 | CHANGED enable lightgallery support
lightgallery = false
locale = "" # FixIt 0.2.15 | NEW
# FixIt 0.1.1 | NEW Disqus comment config (https://disqus.com)
Expand Down Expand Up @@ -593,8 +593,10 @@
path = ""
visitor = true
commentCount = true
# It take effect when `params.page.lightgallery` is enabled
# FixIt 0.2.17 | CHANGED enable lightgallery support
lightgallery = false
# FixIt 0.2.17 | NEW enable Katex support
katex = false
# FixIt 0.2.14 | NEW Giscus comments config
[params.page.comment.giscus]
enable = false
Expand Down
7 changes: 1 addition & 6 deletions layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@
{{- end -}}

{{- /* KaTeX */ -}}
{{- $math := $params.math -}}
{{- if eq $math true -}}
{{- $math = .Site.Params.page.math | default dict -}}
{{- else if eq $math false -}}
{{- $math = dict "enable" false -}}
{{- end -}}
{{- $math := .Scratch.Get "math" -}}
{{- if $math.enable -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
Expand Down
9 changes: 9 additions & 0 deletions layouts/partials/init/patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@
{{- $reward = dict "enable" false -}}
{{- end -}}
{{- .Scratch.Set "reward" $reward -}}

{{- /* KaTeX data patch */ -}}
{{- $math := $params.math -}}
{{- if eq $math true -}}
{{- $math = .Site.Params.page.math | default dict -}}
{{- else if eq $math false -}}
{{- $math = dict "enable" false -}}
{{- end -}}
{{- .Scratch.Set "math" $math -}}
28 changes: 25 additions & 3 deletions layouts/partials/single/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,35 @@
async
defer
></script>
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://giscus.app/" rel="external nofollow noopener noreferrer">giscus</a>.
</noscript>
</div>
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://giscus.app/" rel="external nofollow noopener noreferrer">giscus</a>.
</noscript>
{{- end -}}
{{- end -}}
</div>
{{- /* lightgallery for Artalk and Twikoo */ -}}
{{- $params := .Scratch.Get "params" -}}
{{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/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" -}}
{{- $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" -}}
{{- $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" -}}
{{- end -}}
{{- /* KaTeX for Twikoo */ -}}
{{- $math := .Scratch.Get "math" -}}
{{- if not $math.enable | and $twikoo.enable | and $twikoo.katex -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | 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" -}}
{{- end -}}
{{- end -}}

{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}

1 comment on commit b974fa5

@vercel
Copy link

@vercel vercel bot commented on b974fa5 Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fixit – ./

fixit.lruihao.cn
fixit-x-cell.vercel.app
fixit-git-master-x-cell.vercel.app
hugofixit.vercel.app

Please sign in to comment.