mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
c239c643fe
bcc4f9324Add transparent background in rgba for search fieldfce835feaTrim newlines from .Inner in the 'code' shortcode9117f54b3Remove code toggle from netlify.tomlbabbb9090fix version number - 404 errord28cf15e1The 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.f4ef4c146Repairing link from issue 131 using jamesrhea's comment https://github.com/gohugoio/hugoDocs/issues/131#issuecomment-3240837397f73f5685Update related.md (#1436)41d24297cMention `not` (#1432) git-subtree-dir: docs git-subtree-split:bcc4f93242
27 lines
1.2 KiB
HTML
27 lines
1.2 KiB
HTML
{{ $file := .Get "file" }}
|
|
{{ $codeLang := "" }}
|
|
{{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
|
|
{{ with $suffix }}
|
|
{{ $codeLang = (index . 0 | strings.TrimPrefix ".") }}
|
|
{{ end }}
|
|
{{ with .Get "codeLang" }}{{ $codeLang = . }}{{ end }}
|
|
{{ if eq $codeLang "html" }}
|
|
{{ $codeLang = "go-html-template" }}
|
|
{{ end }}
|
|
<div class="code relative" id="{{ $file | urlize }}">
|
|
{{- with $file -}}
|
|
<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 }}>
|
|
{{ $inner := trim .Inner "\n" | safeHTML }}
|
|
{{ if .Get "nocode" }}{{ $inner }}{{ else }}{{ with $codeLang }}{{ highlight $inner . "" }}{{ else }}<pre><code>{{ $inner }}</code></pre>{{ end }}{{ end }}
|
|
</div>
|
|
|
|
</div>
|