diff options
author | Dillon <dillonzq@outlook.com> | 2020-03-21 15:52:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-21 15:52:12 +0300 |
commit | b6ce753ae7892839899962b879e2cc5808c60732 (patch) | |
tree | 7faafbb7c91de49ea96fa44d3727cc4018c1f07c /layouts/shortcodes | |
parent | aed8734d83cf68df3b8dc62b27c37888c5cc9569 (diff) |
feat(shortcodes): add width and height params for echarts shortc… (#192)
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/echarts.html | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/layouts/shortcodes/echarts.html b/layouts/shortcodes/echarts.html index 4f24b26..ec0e4c8 100644 --- a/layouts/shortcodes/echarts.html +++ b/layouts/shortcodes/echarts.html @@ -2,5 +2,7 @@ {{- $content := .Inner | transform.Unmarshal | jsonify -}} {{- $id := partial "function/id.html" (dict "content" $content "scratch" $scratch) -}} -<div class="echarts" id="{{ $id }}"></div> +{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}} +{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}} +<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div> {{- $scratch.Set "echarts" true -}} |