Use styles for syntax highlighting in XML
This commit is contained in:
@@ -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 }}
|
||||
|
@@ -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 }}
|
||||
|
20
layouts/shortcodes/paige/code.xml
Normal file
20
layouts/shortcodes/paige/code.xml
Normal file
@@ -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>
|
Reference in New Issue
Block a user