diff --git a/assets/css/_core/_layout.scss b/assets/css/_core/_layout.scss index ac175662..e9f57f70 100644 --- a/assets/css/_core/_layout.scss +++ b/assets/css/_core/_layout.scss @@ -17,14 +17,14 @@ } } - &.container { + &.fi-container { display: flex; align-items: flex-start; justify-content: center; padding-inline: 1rem; gap: 0.5rem; - &.container-reverse { + &[data-reverse] { flex-direction: row-reverse; } diff --git a/assets/css/_core/_media.scss b/assets/css/_core/_media.scss index 33cb204a..1be96977 100644 --- a/assets/css/_core/_media.scss +++ b/assets/css/_core/_media.scss @@ -67,7 +67,7 @@ top: 0; } // adjust the scroll margin top of the content anchors on the page - body:not([data-header-desktop='auto']) &+.container .content [id] { + body:not([data-header-desktop='auto']) &+.fi-container .content [id] { scroll-margin-top: calc(var(--#{$prefix}scroll-mt) + var(--#{$prefix}breadcrumb-height)); } } @@ -95,7 +95,7 @@ top: 0; } // adjust the scroll margin top of the content anchors on the page - body:not([data-header-mobile='auto']) &+.container .content [id] { + body:not([data-header-mobile='auto']) &+.fi-container .content [id] { scroll-margin-top: calc(var(--#{$prefix}scroll-mt) + var(--#{$prefix}breadcrumb-height)); } } diff --git a/assets/js/theme.js b/assets/js/theme.js index fd0a2132..ee646540 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -371,7 +371,7 @@ class FixIt { const $breadcrumbContainer = document.querySelector('.breadcrumb-container.sticky') this.breadcrumbHeight = $breadcrumbContainer?.clientHeight ?? 0; if (this.breadcrumbHeight) { - document.querySelector('main.container')?.style.setProperty('--fi-breadcrumb-height', `${this.breadcrumbHeight}px`); + document.querySelector('main.fi-container')?.style.setProperty('--fi-breadcrumb-height', `${this.breadcrumbHeight}px`); } } @@ -567,11 +567,11 @@ class FixIt { const $tocLiElements = $tocCore.getElementsByTagName('li'); const $headingElements = document.getElementsByClassName('heading-element'); const headerHeight = document.getElementById('header-desktop').offsetHeight; - document.querySelector('.container').addEventListener('resize', () => { - $toc.style.marginBottom = `${document.querySelector('.container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; + document.querySelector('.fi-container').addEventListener('resize', () => { + $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; }); this._tocOnScroll = this._tocOnScroll || (() => { - $toc.style.marginBottom = `${document.querySelector('.container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; + $toc.style.marginBottom = `${document.querySelector('.fi-container').clientHeight - document.querySelector('.post-footer').offsetTop}px`; this.util.forEach($tocLinkElements, ($tocLink) => { $tocLink.classList.remove('active'); }); diff --git a/hugo.toml b/hugo.toml index d1760ff1..943bcab3 100644 --- a/hugo.toml +++ b/hugo.toml @@ -699,7 +699,12 @@ mainSections = [] loop = false # FixIt 0.2.15 | NEW Mermaid config + # See https://github.com/mermaid-js/mermaid [params.mermaid] + # FixIt 0.4.0 | NEW Mermaid ESM module CDN source + cdn = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" + # FixIt 0.4.0 | NEW ZenUML ESM module CDN source + zenuml = "https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs" # For values, see https://mermaid.js.org/config/theming.html#available-themes themes = ["default", "dark"] diff --git a/layouts/_partials/assets.html b/layouts/_partials/assets.html index dab8c325..4f50b864 100644 --- a/layouts/_partials/assets.html +++ b/layouts/_partials/assets.html @@ -130,14 +130,10 @@ {{- /* mermaid */ -}} {{- if .Store.Get "hasMermaid" -}} - {{- $config = dict "themes" .Site.Params.mermaid.themes | dict "mermaid" | merge $config -}} - + {{- $mermaid := .Param "mermaid" -}} + {{- $content := printf "import mermaid from %q; import zenuml from %q; await mermaid.registerExternalDiagrams([zenuml]); window.mermaid = mermaid;" $mermaid.cdn $mermaid.zenuml -}} + {{- dict "Content" $content "Attr" `type="module"` | dict "Page" $ "Data" | partial "store/script.html" -}} + {{- $config = dict "themes" $mermaid.themes | dict "mermaid" | merge $config -}} {{- end -}} {{- /* ECharts */ -}} diff --git a/layouts/_partials/plugin/script.html b/layouts/_partials/plugin/script.html index a694c537..aaefa4b7 100644 --- a/layouts/_partials/plugin/script.html +++ b/layouts/_partials/plugin/script.html @@ -50,7 +50,7 @@ {{- else -}} {{- with .Content -}} - + {{ . | safeJS }} {{- end -}} {{- end -}} {{- end -}} diff --git a/layouts/baseof.html b/layouts/baseof.html index b7c6ef5a..56fa3ac2 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -26,7 +26,7 @@ {{- partial "header.html" . -}} {{- partial "breadcrumb.html" . -}} {{- $toc := .Store.Get "toc" -}} -
+
{{- block "content" . }}{{ end -}}
{{- partialCached "footer.html" . -}}