Hugo Shortcodes Library
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Highlight

A Hugo shortcode to highlight short snippets of text.

How to use

# file.md
{{< highlight text="text to highlight" >}}

{{< highlight text="text to highlight" color="#000" >}}

Shortcode


{{ $color := "#FFFF00" }}
{{ with .Get "color" }}
    {{ $color = . }}    
{{ end }}
<mark style="background-color: {{ $color }}">{{ with .Get "text" }}{{.}}{{end}}</mark>

Sample

text to highlight

text to highlight

Base Source