Add Mermaid as bundled dependency

pull/24/head
James Panther 2021-10-28 12:39:34 +11:00
parent 14a6aba0b5
commit acbcfacd6f
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
7 changed files with 1675 additions and 15 deletions

View File

@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed ### Changed
- Site name, author and menus will now render Markdown and Emoji - Site name, author and menus will now render Markdown and Emoji
- Bundled Mermaid for better vendor dependency management
## [1.4.0] - 2021-10-20 ## [1.4.0] - 2021-10-20

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,9 @@
{{ if not .Site.IsServer }} {{ if not .Site.IsServer }}
{{ with .Site.Params.fathomAnalytics.site }} {{ with .Site.Params.fathomAnalytics.site }}
{{ if isset $.Site.Params.fathomanalytics "domain" }} {{ if isset $.Site.Params.fathomanalytics "domain" }}
<script src="https://{{ $.Site.Params.fathomanalytics.domain }}/script.js" data-site="{{ . }}" defer></script> <script defer src="https://{{ $.Site.Params.fathomanalytics.domain }}/script.js" data-site="{{ . }}"></script>
{{ else }} {{ else }}
<script src="https://cdn.usefathom.com/script.js" data-site="{{ . }}" defer></script> <script defer src="https://cdn.usefathom.com/script.js" data-site="{{ . }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}

View File

@ -41,11 +41,3 @@
{{ partialCached "extend-footer.html" . }} {{ partialCached "extend-footer.html" . }}
{{ end }} {{ end }}
</footer> </footer>
{{/* Include mermaid.js only on pages that use the shortcode */}}
{{- if .Page.HasShortcode "mermaid" -}}
<script src="https://unpkg.com/mermaid@8.13.3/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({ theme: "default" });
</script>
{{- end -}}

View File

@ -100,6 +100,19 @@
{{ range $name, $url := $links }}<link href="{{ $url }}" rel="me" />{{ end }} {{ range $name, $url := $links }}<link href="{{ $url }}" rel="me" />{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{/* Mermaid */}}
{{ if .Page.HasShortcode "mermaid" }}
{{ $mermaidJS := resources.Get "vendor/mermaid/mermaid.min.js" }}
{{ if $mermaidJS }}
{{ $mermaidJS := $mermaidJS | resources.Fingerprint "sha512" }}
<script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
mermaid.initialize({ theme: "default" });
});
</script>
{{ end }}
{{ end }}
{{/* Analytics */}} {{/* Analytics */}}
{{ partialCached "analytics.html" .Site }} {{ partialCached "analytics.html" .Site }}
{{/* Extend head - eg. for custom analytics scripts, etc. */}} {{/* Extend head - eg. for custom analytics scripts, etc. */}}

1645
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,9 @@
"description": "Congo theme for Hugo", "description": "Congo theme for Hugo",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"preinstall": "rimraf assets/vendor",
"postinstall": "vendor-copy",
"assets": "rimraf assets/vendor && vendor-copy",
"dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w", "dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
"build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit", "build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit",
"example": "hugo server --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ -p 8008" "example": "hugo server --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ -p 8008"
@ -26,9 +29,18 @@
"homepage": "https://github.com/jpanther/congo#readme", "homepage": "https://github.com/jpanther/congo#readme",
"devDependencies": { "devDependencies": {
"@tailwindcss/typography": "^0.4.1", "@tailwindcss/typography": "^0.4.1",
"mermaid": "^8.13.3",
"prettier": "^2.3.2", "prettier": "^2.3.2",
"prettier-plugin-go-template": "^0.0.11", "prettier-plugin-go-template": "^0.0.11",
"rimraf": "^3.0.2",
"tailwind-underline-utils": "^1.1.3", "tailwind-underline-utils": "^1.1.3",
"tailwindcss": "^2.2.17" "tailwindcss": "^2.2.17",
"vendor-copy": "^3.0.1"
},
"vendorCopy": [
{
"from": "node_modules/mermaid/dist/mermaid.min.js",
"to": "assets/vendor/mermaid/mermaid.min.js"
} }
]
} }