diff --git a/assets/js/darkmode.js b/assets/js/darkmode.js index c1a0ca429..11ce15f72 100644 --- a/assets/js/darkmode.js +++ b/assets/js/darkmode.js @@ -8,12 +8,7 @@ const syntaxTheme = document.querySelector("#theme-link"); if (currentTheme) { document.documentElement.setAttribute('saved-theme', currentTheme); - if (currentTheme === 'dark') { - syntaxTheme.href = '{{ $darkSyntax.Permalink }}'; - } - else { - syntaxTheme.href = '{{ $lightSyntax.Permalink }}'; - } + (currentTheme === 'dark') ? syntaxTheme.href = '{{ $darkSyntax.Permalink }}' : syntaxTheme.href = '{{ $lightSyntax.Permalink }}'; } const switchTheme = (e) => { diff --git a/content/notes/hosting.md b/content/notes/hosting.md index 70f9d04cf..fffcd653a 100644 --- a/content/notes/hosting.md +++ b/content/notes/hosting.md @@ -66,7 +66,7 @@ Please note that the `cname` field should *not* have any path `e.g. end with /qu [Reference `deploy.yaml` here](https://github.com/jackyzha0/quartz/blob/hugo/.github/workflows/deploy.yaml) -```yaml +```yaml {title=".github/workflows/deploy.yaml"} - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 8dda6a8c0..dbcf732fd 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,8 +1,9 @@ {{$src := .Destination | safeURL }} +{{$width := index (split .Text "|") 1 | default "auto" }} {{$external := strings.HasPrefix $src "http" }} {{- if $external -}} -{{ .Text }} +{{ .Text }} {{- else -}} {{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}} -{{ .Text }} +{{ .Text }} {{- end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6e1475547..4a4d40085 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -95,6 +95,7 @@ {{if $.Site.Data.config.enableClipboard -}} initClipboard(); {{ end }} + {{if $.Site.Data.config.enableSPA -}} addTitleToCodeBlocks(); {{ end }} @@ -135,6 +136,7 @@ window.addEventListener("DOMContentLoaded", initClipboard); {{ end }} {{ end }} + {{if $.Site.Data.config.enableCodeBlockTitle -}} {{if $.Site.Data.config.enableSPA -}} addTitleToCodeBlocks(); @@ -166,8 +168,11 @@ navigate: (url) => (window.location.href = url), prefetch: () => {}, } - init() - render() + + window.addEventListener("DOMContentLoaded", () => { + init() + render() + }) {{end}}