【发布时间】:2021-10-13 00:17:39
【问题描述】:
在hugo(版本v0.77.0)中,我正在尝试使用一些特定的样式来呈现表格。我正在使用
我正在尝试使用 zwbetz 的 {{ bootstrap-table "classname" }} shortcode。它在/layouts/shortcodes/bootstrap-table.html 中定义如下:
{{ $htmlTable := .Inner | markdownify }}
{{ $class := .Get 0 }}
{{ $old := "<table>" }}
{{ $new := printf "<table class=\"%s\">" $class }}
{{ $htmlTable := replace $htmlTable $old $new }}
{{ $htmlTable | safeHTML }}
它可以与 Markdown 中的一个简单表格一起正常工作,如下所示:
{{< bootstrap-table "someclassname" >}}
| animal | sound |
|--------|-------|
| dog | meow |
| cat | woof |
{{< /bootstrap-table > }}
但是,如果被标记的表格包含其他 Hugo 短代码,它会拒绝表格标记并创建一个空表格,然后在生成的 html 中通过消息(在 html cmets 中)说 Hugo 拒绝了一些 html。
这是一个令人讨厌的降价表。
{{< bootstrap-table "someclassname" >}}
| animal | sound |
|--------|-------|
| {{< img src="dog.jpg" alt="Dog" class="align__left size__80" >}} | meow |
| {{< img src="cat.jpg" alt="Cat" class="align__left size__80" >}} | woof |
{{< /bootstrap-table > }}
我该怎么做才能让这个bootstrap-table Hugo 标签接受我的桌子,里面有图片或其他 Hugo 短代码?
【问题讨论】:
标签: hugo html twitter-bootstrap markdown hugo hugo-shortcode