diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-05-01 11:45:45 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-05-01 11:45:45 +0200 |
commit | c239c643fee10bfa217cb108755b798f8f5f3b10 (patch) | |
tree | e51306feb88c581325c95cc6a437d418168405f9 /layouts | |
parent | 07b8d9466dfb59c429c1b470a0443337bc0aeefe (diff) | |
download | hugo-c239c643fee10bfa217cb108755b798f8f5f3b10.tar.gz hugo-c239c643fee10bfa217cb108755b798f8f5f3b10.zip |
Squashed 'docs/' changes from fb551cc75..bcc4f9324
bcc4f9324 Add transparent background in rgba for search field
fce835fea Trim newlines from .Inner in the 'code' shortcode
9117f54b3 Remove code toggle from netlify.toml
babbb9090 fix version number - 404 error
d28cf15e1 The input search is not displayed correctly in Safari because of the one declaration CSS background property. Safari needs the no-repeat to be after position and size property. Adjusting the search icon to be vertically on center.
f4ef4c146 Repairing link from issue 131 using jamesrhea's comment https://github.com/gohugoio/hugoDocs/issues/131#issuecomment-324083739
7f73f5685 Update related.md (#1436)
41d24297c Mention `not` (#1432)
git-subtree-dir: docs
git-subtree-split: bcc4f93242334f03c6699e2c4226ee178317ec4b
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/shortcodes/code.html | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index eafc02e6b..0ee25149d 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -1,25 +1,26 @@ {{ $file := .Get "file" }} {{ $codeLang := "" }} {{ $suffix := findRE "(\\.[^.]+)$" $file 1 }} -{{ with $suffix }} +{{ with $suffix }} {{ $codeLang = (index . 0 | strings.TrimPrefix ".") }} {{ end }} {{ with .Get "codeLang" }}{{ $codeLang = . }}{{ end }} -{{ if eq $codeLang "html"}} +{{ if eq $codeLang "html" }} {{ $codeLang = "go-html-template" }} {{ end }} -<div class="code relative" id="{{ $file | urlize}}"> +<div class="code relative" id="{{ $file | urlize }}"> {{- with $file -}} - <div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div> + <div class="filename san-serif f6 dib lh-solid pl2 pv2">{{ . }}</div> {{- end -}} {{ if ne (.Get "copy") "false" }} <button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"> </button> {{/* 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 }} + {{ end }} + <div class="code-copy-content nt3" {{ with .Get "download" }}id="{{ . }}"{{ 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> |