diff --git a/docs/content/content-management/shortcodes.md b/docs/content/content-management/shortcodes.md index fdeb6fba1..e396aada8 100644 --- a/docs/content/content-management/shortcodes.md +++ b/docs/content/content-management/shortcodes.md @@ -88,6 +88,7 @@ The `figure` shortcode can use the following named parameters: * `attr` (i.e., attribution) * `attrlink` * `alt` +* `height` #### Example `figure` Input diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index ab2d1f334..ba0d43c65 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -299,6 +299,16 @@ func TestFigureImgWidth(t *testing.T) { CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="100px" %}}`, "\n
\n \n \"apple\"\n \n \n
\n", nil) } +func TestFigureImgHeight(t *testing.T) { + t.Parallel() + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" height="100px" %}}`, "\n
\n \n \"apple\"\n \n \n
\n", nil) +} + +func TestFigureImgWidthAndHeight(t *testing.T) { + t.Parallel() + CheckShortCodeMatch(t, `{{% figure src="/found/here" class="bananas orange" alt="apple" width="50" height="100" %}}`, "\n
\n \n \"apple\"\n \n \n
\n", nil) +} + const testScPlaceholderRegexp = "HAHAHUGOSHORTCODE-\\d+HBHB" func TestExtractShortcodes(t *testing.T) { diff --git a/tpl/tplimpl/template_embedded.go b/tpl/tplimpl/template_embedded.go index dd3254560..2252d65cf 100644 --- a/tpl/tplimpl/template_embedded.go +++ b/tpl/tplimpl/template_embedded.go @@ -21,7 +21,7 @@ func (t *templateHandler) embedShortcodes() { t.addInternalShortcode("figure.html", `
{{ with .Get "link"}}{{ end }} - + {{ if .Get "link"}}{{ end }} {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
{{ if isset .Params "title" }}