assets/js/mode.js
@@ -39,6 +39,12 @@ }); } function setMermaidTheme(mode) { bank.setItem(mermaidThemeKey, mode); let theme_input = elem('.color_choice'); theme_input.value = mode; } function setUserColorMode(mode = false) { const is_dark_mode = currentMode() == dark; const stored_mode = bank.getItem(storageKey); @@ -51,6 +57,8 @@ const user_mode = doc.dataset.mode; doc.dataset.systemmode = sys_mode; user_mode ? pickModePicture(user_mode) : false; setMermaidTheme(user_mode); } setUserColorMode(); assets/js/variables.js
@@ -1,12 +1,11 @@ 'use strict'; // global variables; const doc = document.documentElement; const toggle_id = 'toggle'; const show_id = 'show'; const menu = 'menu'; const active = 'active'; // root_url must end with '/' for relative URLs to work properly let site_title = `{{ replace (lower site.Title) " " "-" }}`; let root_url = '{{ strings.TrimSuffix "/" .Site.BaseURL }}/'; root_url = root_url.startsWith('http') ? root_url : window.location.origin; @@ -37,7 +36,8 @@ const light = 'light'; const dark = 'dark'; const storageKey = 'colorMode'; const storageKey = `${site_title}-color-mode`; const mermaidThemeKey = `${site_title}-mermaid`; const key = '--color-mode'; const mode_data = 'data-mode'; const bank = window.localStorage; assets/sass/_base.sass
@@ -19,6 +19,14 @@ -webkit-text-size-adjust: 100% font-size: 18px @keyframes flash 0% opacity: 0 75% opacity: 0 100% opacity: 1 body font-family: var(--font) background-color: var(--bg) @@ -35,6 +43,8 @@ -moz-osx-font-smoothing: grayscale -webkit-overflow-scrolling: touch max-width: 1440px animation: 0.67s flash ease-in @media screen and (min-width: 1640px) max-width: 1600px assets/sass/_mermaid.sass
@@ -4,4 +4,4 @@ margin-bottom: 2.5rem svg margin: 0 auto display: block display: block exampleSite/go.mod
@@ -2,7 +2,4 @@ go 1.15 require ( github.com/onweru/compose v0.0.0-20230530114506-a2ddf2b32939 // indirect github.com/rwstorer/hugo-theme-compose v0.0.0-20230705005233-e37ac6973101 // indirect ) require github.com/onweru/compose v0.0.0-20230709140616-b352d2c11cd8 // indirect exampleSite/go.sum
@@ -28,39 +28,9 @@ github.com/onweru/compose v0.0.0-20230522093958-40f93a906ddc/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc= github.com/onweru/compose v0.0.0-20230530114506-a2ddf2b32939 h1:XVZlCIf6BUmHReHKp5bt/e4+Vy5NCypqiju/LEcCz4Y= github.com/onweru/compose v0.0.0-20230530114506-a2ddf2b32939/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611001648-0f1fb40e912e h1:EaCAVi8vhFZzgejGR5pf1MJPl+YC6SY+dgEkckbWyHc= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611001648-0f1fb40e912e/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611011250-29764d3cdc54 h1:JE41XHF80/O+LqQnc2/GmNpVUxhdnT+QaQP12TeQ4q0= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611011250-29764d3cdc54/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611013609-aeaea2852b98 h1:9pYay6P/mUgA31ANPqFQBjGI809JhN1Li/umaFeFhIE= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611013609-aeaea2852b98/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611013841-e25e31add480 h1:m+9tc/4S8keQy3IhvdtzlZf0T2rW8LIHBkTD6qS40kM= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611013841-e25e31add480/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611014843-d3652998710e h1:X7/nJFMOqLwYy0a/QPHDxQ1Mq6hJHNI+Tv8xWyBU9Bk= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611014843-d3652998710e/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611021301-f7396f1edb0b h1:y71DHDUESv7+42YRzsXdVoTxCDgvnw+I3Wrzjg9J1Mo= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611021301-f7396f1edb0b/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611022804-cdec55a13770 h1:Kl9D/nTVK2JlmwYrcT2y6yDpoMtaRLTI6mUJtwxK0tQ= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611022804-cdec55a13770/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611030846-a91f59280bbb h1:Wj03s4AZMZ2uVa6yMTDQ2SunKHsA6uh8pKRRBl6xyFc= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611030846-a91f59280bbb/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611031132-ddffdf7dde93 h1:TtzPjBvXJjWYhqPDFumnS4xDFVfAlJEXBFuuhoBK4/U= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611031132-ddffdf7dde93/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611031251-11099f76fce2 h1:tWGK7hU0ptbaehbGSlvGpJQHvSUW6ksvBD5SGKqvFWI= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611031251-11099f76fce2/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611033347-7c57127c2f46 h1:SXeF48TLLcxOMG2ZFpv2+hu9IhfrMWzPxYWEJ2UnATU= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611033347-7c57127c2f46/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611034420-6b46b885a5f3 h1:GdIR5ZgIV0OQyLBt7z7wph7ttrflg9Zu8t+URhCSMQA= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611034420-6b46b885a5f3/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611035253-44d4e6b24d65 h1:kcZ3SINPfK3QTk0cpn0j0KxSDyJWz32k9VAEbfKgc+s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611035253-44d4e6b24d65/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611040011-726a11f5e7b8 h1:lpduewP+0F23NVASVa7WJ96JNxFfWeeKUybWjFhfSac= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611040011-726a11f5e7b8/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611041900-16c2ce96ef5a h1:O5zmkIshvR3RKLwxxDhFOXz1RGvsF23KAv9MrCxBrPc= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611041900-16c2ce96ef5a/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611042716-1ae2e3d6a2af h1:XV6rJpiYMEox+r63cdP9ShXR9E2jshhiij1Ftu7I6VI= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611042716-1ae2e3d6a2af/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611043851-fa22efc00a50 h1:aAO6ExmIP513PY1Eny9ROAHMsKy2mcgH2j4Sd+gyJNU= github.com/rwstorer/hugo-theme-compose v0.0.0-20230611043851-fa22efc00a50/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/rwstorer/hugo-theme-compose v0.0.0-20230705005233-e37ac6973101 h1:LdUnwLgzORSs86EpkgioaHoSCNOLVZpqBBBiNECa7Ts= github.com/rwstorer/hugo-theme-compose v0.0.0-20230705005233-e37ac6973101/go.mod h1:7TS3BoBV/IcLPRT2r7LyTyOqzsS5P5sXKlNpGgxdK/s= github.com/onweru/compose v0.0.0-20230615081942-67dad4f6ef90 h1:YtZ28Fg638nbpKbvwEB16c3LBIdDxEAi8E0eWmo+Dw0= github.com/onweru/compose v0.0.0-20230615081942-67dad4f6ef90/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc= github.com/onweru/compose v0.0.0-20230709124724-5ebe0b0b8d16 h1:cMfQ9aU/j2yJYbzuytHa3TAnFryZmQtp08nDCxUnnNk= github.com/onweru/compose v0.0.0-20230709124724-5ebe0b0b8d16/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc= github.com/onweru/compose v0.0.0-20230709140616-b352d2c11cd8 h1:6D3uUi+TB00CDWbDCmWpJVjzYAy8KcCZ4a7Is36BrzI= github.com/onweru/compose v0.0.0-20230709140616-b352d2c11cd8/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc= layouts/_default/baseof.html
@@ -24,22 +24,42 @@ {{ if .IsHome }} {{ $uniqueHomepage = true }} {{ end }} <head> {{- partial "head" . }} </head> <body class="page-{{ .Kind }}" id="pagetop"> <header class="nav_header"> {{- partial "nav" . }} </header> {{ if or (eq .Section site.Params.blogDir) (eq .Type "search" ) }} {{- block "main" . }}{{ end }} {{ else }} {{ $uniqueHomepage = false }} <div class="main wrap pt-4"> {{ $docSections := site.Params.docSections }} {{- with $docSections }}{{- else }} {{- $docSections = "docs" }} {{- end }} {{ $uniqueHomepage := .IsHome }} {{ if site.Params.uniqueHomepage }} {{ if .IsHome }} {{ $uniqueHomepage = true }} {{ end }} {{ else }} {{ $uniqueHomepage = false }} {{ end }} {{- if and (in $docSections .Section) (ne $uniqueHomepage true) }} {{- partial "document" . }} {{- else }} <div class="content"> {{- block "main" . }}{{ end }} </div> {{- end -}} </div> {{ end }} {{- if and (in $docSections .Section) (ne $uniqueHomepage true) }} {{- partial "document" . }} {{- else }} <div class="content"> {{- block "main" . }}{{ end }} </div> {{- end -}} </div> {{ end }} {{- partial "scripts/translations" . -}} {{- partialCached "footer" . -}} {{- partialCached "sprites" . -}} {{- partial "scripts/bundle" . -}} {{- partial "scripts/other" . -}} </body> {{- partial "scripts/translations" . -}} {{- partialCached "footer" . -}} {{- partialCached "sprites" . -}} {{- partial "scripts/bundle" . -}} {{- partial "scripts/mermaid" . -}} </body> </html> layouts/_default/term.html
@@ -1,7 +1,7 @@ {{ define "main" }} {{- $pages := .Data.Pages }} {{ .Data.Terms }} <div class = 'wrap pt-2 mt-2'> <div class="wrap pt-2 mt-2"> {{- $paginator := .Paginate $pages -}} {{- $size := $paginator.PageSize }} {{- $scratch := newScratch }} @@ -16,27 +16,20 @@ {{- if in $image "https://" }} {{- $bg = $image }} {{- end }} <article class = 'article mb-2'> <a href = '{{ $value.Permalink }}' {{ if eq $index 0 }} class = 'grid-reverse' {{ end }}> <div class = 'article_thumb' style='background-image: url({{ $bg }})'></div> <div class = 'article_meta {{ if eq $index 0 }} center_y {{ end }}'> <time class = 'post_date'>{{ dateFormat "January 02, 2006" $value.Date }}</time> <h3 class = 'article_title'>{{ $value.Title }}</h3> <div class = 'article_excerpt {{ if eq $index 0 }} visible {{ end }}'> <article class="article mb-2"> <a href="{{ $value.Permalink }}" {{ if eq $index 0 }} class=grid-reverse {{ end }}> <div class="article_thumb" style="background-image: url({{ $bg }})"></div> <div class="article_meta {{ if eq $index 0 }} center_y {{ end }}"> <time class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</time> <h3 class="article_title">{{ $value.Title }}</h3> <div class="article_excerpt {{ if eq $index 0 }} visible {{ end }}"> <p>{{ $value.Summary | truncate 100 }}</p> </div> </div> </a> </article> {{- if and (eq $index 0) (gt $size 1) }}<div class = 'grid-2 article_showcase'>{{ end }} {{- if and (eq $index 0) (gt $size 1) }}<div class="grid-2 article_showcase">{{ end }} {{- if and (eq $index (add $size -1)) (gt $size 1) }}</div>{{ end }} {{- end }} </div> <!-- <a href = '{{ absURL (printf "post/%s" "") }}' class = 'post_nav'> <span class = 'post_next'>View Archive <svg class="icon icon_scale"> <use xlink:href="#double-arrow"></use> </svg> </span> </a> --> {{ end }} layouts/partials/functions/getCodeConfig.html
@@ -1,4 +1,3 @@ <!-- will return an array holding 1) Whether to show line numbers or not 2) maximum number of lines per code block --> {{- $s := site.Params }} {{- $p := .Params }} {{- $maxCodeLines := default 100 $s.codeMaxLines }} layouts/partials/mode.html
@@ -1,4 +1,4 @@ <div class="color_mode"> <label for="mode"></label> <div class=color_mode> <label for=mode></label> <input type="checkbox" class="color_choice standardize-input" id="mode" title="Toggle Dark Mode"> </div> layouts/partials/nav.html
@@ -1,4 +1,4 @@ {{- $s := .Site }} {{- $s := site }} {{- $sp := $s.Params }} <nav class="wrap nav menu"> <a href='{{ absLangURL "" }}' class="nav_brand"> @@ -31,19 +31,19 @@ </li> {{- end }} {{ $repo := $sp.source }} {{ with $sp.source }} <li class="nav-item nav_repo"> <a class="nav-link" href="{{ $repo.url }}" target="_blank"> {{ if $repo.iconLight }} {{- $litPath := absURL ($repo.iconLight) }} {{- $darkPath := absURL ($repo.iconDark) }} <a class="nav-link" href="{{ .url }}" target="_blank"> {{ if .iconLight }} {{- $litPath := absURL .iconLight }} {{- $darkPath := absURL .iconDark }} <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}"> <img src="{{ $litPath }}" alt="{{ $repo.name }} Repo"> <img src="{{ $litPath }}" alt="{{ .name }} Repo"> </picture> {{ else }} {{ $repo.name }} {{ end }} {{ else }}{{ .name }}{{ end }} </a> </li> {{ end }} <li class="nav-item">{{ partial "mode" . }}</li> </ul> </nav> layouts/partials/opengraph.html
@@ -1,6 +1,6 @@ {{- template "_internal/opengraph.html" . -}} {{- template "_internal/schema.html" . -}} {{- template "_internal/twitter_cards.html" . -}} {{- if eq (getenv "HUGO_ENV") "production" }} {{- if hugo.IsProduction }} {{- template "_internal/google_analytics.html" . }} {{- end }} layouts/partials/scripts/mermaid.html
New file @@ -0,0 +1,25 @@ {{ if in .Content "mermaid" }} <script type="module"> import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'; let theme_input = elem('.color_choice'); let key = theme_input.value; function getTheme(mode) { return key == 'dark' ? 'dark' : 'base'; } function initializeMermaid(mode) { mermaid.initialize( { startOnLoad: true, theme: getTheme(mode) } ); } initializeMermaid(key); theme_input.addEventListener('change', e => { location.reload(); initializeMermaid(e.target.value); }); </script> {{ end }} layouts/partials/scripts/other.html
File was deleted layouts/partials/scripts/translations.html
@@ -6,8 +6,6 @@ const toggle_line_wrap_text = '{{ T "toggle_line_wrap" }}'; const resize_snippet = '{{ T "resize_snippet" }}'; const not_set = '{{ T "not_set" }}'; // defined in i18n / translation files const quick_links = '{{ T "quick_links" }}'; const search_results_label = '{{ T "search_results_label" }}'; const short_search_query = '{{ T "short_search_query" }}'