mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-14 06:17:20 +00:00
feat: add support for mindmaps
This commit is contained in:
1 parent
7644a28711
commit
ef8f0a96f3
5 files changed
+150
-7
No files matched your search
@@ -4,6 +4,10 @@
|
||||
// - The CommonHTML.linebreaks option is not yet implemented (but may be in a future release)
|
||||
// - The TeX.noUndefined.attributes option is not yet implemented (but may be in a future release)
|
||||
window.MathJax = {
|
||||
options: {
|
||||
// Don't render math in mindmaps as Markmap has its own math renderer.
|
||||
ignoreHtmlClass: 'markmap',
|
||||
},
|
||||
tex: {
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<div class="markmap" style="height: {{.Attributes.height | default "500px"}};">
|
||||
{{- .Inner | safeHTML }}
|
||||
</div>
|
||||
{{ .Page.Store.Set "has_markmap" true }}
|
||||
@@ -136,6 +136,29 @@
|
||||
<script src="{{ $headroom.RelPermalink }}" type="module"></script>
|
||||
{{- end -}}
|
||||
|
||||
{{/* Mindmaps */}}
|
||||
{{ if .Page.Store.Get "has_markmap" -}}
|
||||
<style>
|
||||
.markmap > svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.markmap = {
|
||||
autoLoader: {
|
||||
manual: false,
|
||||
onReady() {
|
||||
const { autoLoader, builtInPlugins } = window.markmap;
|
||||
// Disable Prism highlighting plugin as it conflicts and attempts to re-render code blocks outside of Markmap.
|
||||
autoLoader.transformPlugins = builtInPlugins.filter(plugin => plugin.name !== 'prism');
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/markmap-autoloader"></script>
|
||||
{{ end -}}
|
||||
|
||||
{{ $js_license := printf "/*! Wowchemy v%s | https://wowchemy.com/ */\n" site.Data.wowchemy.version }}
|
||||
{{ $js_license := $js_license | printf "%s/*! Copyright 2016-present George Cushen (https://georgecushen.com/) */\n" }}
|
||||
{{ $js_license := $js_license | printf "%s/*! License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */\n" }}
|
||||
|
||||
Reference in new issue
Block a user