Skip to content

Commit 647317a

Browse files
authored
chore: bump docsy and hugo fix templating issue (#2714)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 18e5824 commit 647317a

File tree

5 files changed

+77
-6
lines changed

5 files changed

+77
-6
lines changed

.github/workflows/hugo.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
build:
3333
runs-on: ubuntu-latest
3434
env:
35-
HUGO_VERSION: 0.125.4
35+
HUGO_VERSION: 0.145.0
3636
steps:
3737
- name: Install Hugo CLI
3838
run: |

docs/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/google/docsy-example
22

33
go 1.12
44

5-
require github.com/google/docsy v0.10.0 // indirect
5+
require github.com/google/docsy v0.11.0 // indirect

docs/go.sum

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
22
github.com/FortAwesome/Font-Awesome v0.0.0-20240402185447-c0f460dca7f7/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
3+
github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
34
github.com/google/docsy v0.9.1 h1:+jqges1YCd+yHeuZ1BUvD8V8mEGVtPxULg5j/vaJ984=
45
github.com/google/docsy v0.9.1/go.mod h1:saOqKEUOn07Bc0orM/JdIF3VkOanHta9LU5Y53bwN2U=
56
github.com/google/docsy v0.10.0 h1:6tMDacPwAyRWNCfvsn/9qGOZDQ8b0aRzjRZvnZPY5dg=
67
github.com/google/docsy v0.10.0/go.mod h1:c0nIAqmRTOuJ01F85U/wJPQtc3Zj9N58Kea9bOT2AJc=
8+
github.com/google/docsy v0.11.0 h1:QnV40cc28QwS++kP9qINtrIv4hlASruhC/K3FqkHAmM=
9+
github.com/google/docsy v0.11.0/go.mod h1:hGGW0OjNuG5ZbH5JRtALY3yvN8ybbEP/v2iaK4bwOUI=
710
github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc=
811
github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
912
github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!--TODO remove it with new docy release (next after 0.11.0)-->
2+
{{ $version := .Site.Params.mermaid.version | default "latest" -}}
3+
4+
{{ $cdnurl := printf "https://cdn.jsdelivr.net/npm/mermaid@%s/dist/mermaid.esm.min.mjs" $version -}}
5+
{{ with try (resources.GetRemote $cdnurl) -}}
6+
{{ with .Err -}}
7+
{{ errorf "Could not retrieve mermaid script from CDN. Reason: %s." . -}}
8+
{{ end -}}
9+
{{ else -}}
10+
{{ errorf "Invalid Mermaid version %s, could not retrieve this version from CDN." $version -}}
11+
{{ end -}}
12+
13+
<script type="module" async>
14+
import mermaid from "{{ $cdnurl }}";
15+
16+
(function ($) {
17+
if ($('.mermaid').length == 0) {
18+
mermaid.initialize({ startOnLoad: false });
19+
return;
20+
}
21+
22+
var params = {{ with .Site.Params.mermaid }}{{ . | jsonify | safeJS }}{{ else }}{}{{- end }};
23+
24+
// Site params are stored with lowercase keys; lookup correct casing
25+
// from Mermaid default config.
26+
var norm = function (defaultConfig, params) {
27+
var result = {};
28+
for (const key in defaultConfig) {
29+
const keyLower = key.toLowerCase();
30+
if (defaultConfig.hasOwnProperty(key) && params.hasOwnProperty(keyLower)) {
31+
if (typeof defaultConfig[key] === "object") {
32+
result[key] = norm(defaultConfig[key], params[keyLower]);
33+
} else {
34+
result[key] = params[keyLower];
35+
}
36+
}
37+
}
38+
return result;
39+
};
40+
41+
var settings = norm(mermaid.mermaidAPI.defaultConfig, params);
42+
settings.startOnLoad = true;
43+
if ($('html[data-bs-theme="dark"]').length) {
44+
settings.theme = 'dark';
45+
}
46+
mermaid.initialize(settings);
47+
48+
// Handle light/dark mode theme changes
49+
const lightDarkModeThemeChangeHandler = function (mutationsList, observer) {
50+
for (const mutation of mutationsList) {
51+
if (mutation.type === 'attributes' && mutation.attributeName === 'data-bs-theme') {
52+
// Mermaid doesn't currently support reinitialization, see
53+
// https://github.com/mermaid-js/mermaid/issues/1945. Until then,
54+
// just reload the page.
55+
location.reload();
56+
}
57+
}
58+
};
59+
60+
const observer = new MutationObserver(lightDarkModeThemeChangeHandler);
61+
observer.observe(document.documentElement, {
62+
attributes: true,
63+
attributeFilter: ['data-bs-theme']
64+
});
65+
// observer.disconnect();
66+
67+
})(jQuery);
68+
</script>

docs/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "docsy-example-site",
3-
"version": "0.9.1",
4-
"version.next": "0.9.2-dev.0-unreleased",
2+
"name": "java-operator-sdk",
3+
"version": "0.10.0",
4+
"version.next": "0.10.1-dev.0-unreleased",
55
"description": "Example site that uses Docsy theme for technical documentation.",
66
"repository": "github:google/docsy-example",
77
"homepage": "https://javaoperatorsdk.io",
@@ -34,7 +34,7 @@
3434
"update:pkg:hugo": "npm install --save-dev --save-exact hugo-extended@latest"
3535
},
3636
"devDependencies": {
37-
"autoprefixer": "^10.4.19",
37+
"autoprefixer": "^10.4.20",
3838
"cross-env": "^7.0.3",
3939
"hugo-extended": "0.125.4",
4040
"postcss-cli": "^11.0.0"

0 commit comments

Comments
 (0)