Use styles for syntax highlighting in XML
parent
9fafcc5215
commit
9d657b47e3
@ -1,3 +1,14 @@
|
|||||||
{{ $result := transform.HighlightCodeBlock . (merge .Options (dict "noclasses" true "style" "github")) }}
|
{{ $context := . }}
|
||||||
|
|
||||||
|
{{ $options := dict }}
|
||||||
|
{{ $overrides := dict "noclasses" true }}
|
||||||
|
|
||||||
|
{{ with $context.Options }}
|
||||||
|
{{ $options = merge $overrides . }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $options = $overrides }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $result := transform.HighlightCodeBlock $context $options }}
|
||||||
|
|
||||||
{{ $result.Wrapped }}
|
{{ $result.Wrapped }}
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
{{ $result := transform.HighlightCodeBlock . (merge .Options (dict "noclasses" true "style" "github")) }}
|
{{ $context := . }}
|
||||||
|
|
||||||
|
{{ $options := dict }}
|
||||||
|
{{ $overrides := dict "noclasses" true }}
|
||||||
|
|
||||||
|
{{ with $context.Options }}
|
||||||
|
{{ $options = merge $overrides . }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $options = $overrides }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $result := transform.HighlightCodeBlock $context $options }}
|
||||||
|
|
||||||
{{ $result.Wrapped }}
|
{{ $result.Wrapped }}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
{{ $content := .InnerDeindent | strings.TrimLeft "\f\n\r\v" | strings.TrimRight "\f\n\r\t\v " }}
|
||||||
|
{{ $lang := .Get 0 | default (.Get "lang") | default "plaintext" }}
|
||||||
|
{{ $options := .Get "options" }}
|
||||||
|
{{ $unescape := .Get "unescape" }}
|
||||||
|
|
||||||
|
{{ if not $content }}
|
||||||
|
{{ errorf "layouts/shortcodes/paige/code.xml: no content" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $options }}
|
||||||
|
{{ $options = printf "%s,noclasses=true" $options }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $options = "noclasses=true" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $unescape }}
|
||||||
|
{{ $content = htmlUnescape $content }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="paige-shortcode-code">{{ highlight $content $lang $options }}</div>
|
Loading…
Reference in New Issue