mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
16 lines
661 B
HTML
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 -}}
|