Handle corner case with rendering text as code in URL

Without `| safeHTML` for `[`hrefTargetBlank`](http://example.com/hugo-docs) doesn't work`
links text it is rendered verbatimly as `<code>hrefTargetBlank</code>`. After my change it
would use default styling for code.
This commit is contained in:
Marcin Zajączkowski 2020-02-20 12:00:40 +01:00 committed by Bjørn Erik Pedersen
parent 3cb4b19dde
commit 6925cda306

View File

@ -134,7 +134,7 @@ PlainText
Here is a code example for how the render-link.html template could look:
{{< code file="layouts/_default/_markup/render-link.html" >}}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text }}</a>
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
{{< /code >}}
#### Image Markdown example: