Trim newlines from .Inner in the 'code' shortcode

Closes #1437
This commit is contained in:
Joe Mooring 2021-04-30 12:11:34 -07:00 committed by Bjørn Erik Pedersen
parent 9117f54b39
commit fce835fead

View File

@ -19,7 +19,8 @@
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{ end }}
<div class="code-copy-content nt3" {{ with .Get "download" }}id="{{ . }}"{{ end }}>
{{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $codeLang }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
{{ $inner := trim .Inner "\n" | safeHTML }}
{{ if .Get "nocode" }}{{ $inner }}{{ else }}{{ with $codeLang }}{{ highlight $inner . "" }}{{ else }}<pre><code>{{ $inner }}</code></pre>{{ end }}{{ end }}
</div>
</div>