Files
FixIt/layouts/partials/plugin/echarts.html
T
2025-04-26 02:56:16 +08:00

16 lines
661 B
HTML

{{- /* Echarts support for code fences extended and shortcodes. */ -}}
{{- $width := .Options.width | default "100%" -}}
{{- $height := .Options.height | default "30rem" -}}
{{- $js := .Options.js | default false -}}
{{- $attrs := printf `style="width: %v; height: %v;"` $width $height -}}
<div class="echarts" {{ $attrs | safeHTMLAttr }}></div>
{{- if $js -}}
{{- $content := strings.TrimSpace .Inner -}}
{{- if hugo.IsProduction -}}
{{- $content = replaceRE `[\s]+` " " $content -}}
{{- end -}}
<template data-fmt="js">{{ $content | safeJS }}</template>
{{- else -}}
<template>{{ .Inner | transform.Unmarshal | jsonify }}</template>
{{- end -}}