I am now using Hugo FixIt theme (GitHub - hugo-fixit/FixIt: 🔧 A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题) right now . However the default echarts shortcode / codefences does not allow me to write javascript ( see this example ) inside .
Here is the relevant file :
FixIt/layouts/partials/assets.html
FixIt/layouts/shortcodes/echarts.html
FixIt/layouts/partials/plugin/echarts.html
. For the last file , I modify the code as below :{{- /* Echarts support for code fences extended and shortcodes. */ -}} {{- $width := .Options.width | default "100%" -}} {{- $height := .Options.height | default "30rem" -}} {{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}} <div class="echarts" {{ $attrs | safeHTMLAttr }}></div> <script> // eval the text between {{< echarts >}} and {{< /echarts >}} (function() { {{ .Inner | safeJS }} })(); </script> {{- /* EOF */ -}}
but it does not work . Do you guys have any suggestions ?
And : how to make all the javascript variables / const local inside the shortcodes ?
BTW sorry for lack of links , since I am a new user , I am not allow to put more than 2 links .