Syntax highlighting and snippets for Hugo websites.
Makes Hugo templating fit in with the rest of your HTML.
Includes 24 completion snippets for Go Template, see full list below.
Includes snippets for Hugo Shortcodes in Markdown and TOML file, list to come.
Snippet | Tab Trigger | Output |
---|---|---|
Curlies | x | {{ }} |
Dot | xx | {{ . }} |
If | if | {{ if }} {{ end }} |
If Inline | ifi | Same as above but inline |
If/Else | ife | {{ if }} {{ else }} {{ end }} |
If/Else if | ifei | {{ if }} {{ else if }} {{ end }} |
With | with | {{ with }} {{ end }} |
With/Else | withe | {{ with }} {{ else }} {{ end }} |
Range | range | {{ range }} {{ end }} |
Partial | partial | {{ partial "" . }} |
partialCached | partialc | {{ partialCached "" . variant }} |
Naked partial | xpartial | partial "" . |
Block | block | {{ block "main" . }} {{ end }} |
Block define | define | {{ define "block" }} {{ end }} |
Scratch | scra | `{{ .Scratch.Set |
String | str | {{ printf "Something about %s" . }} |
printF | `printf "%s | |
Variable | vars | {{ $var := what }} |
Return | ret | {{ return $return }} |
Debug | debug | {{ printf "%#v" . }} |
Error | error | {{ errorf "%#v" . }} |
Comment | comm | {{/* */}} |
For Hugo Shortcode snippets to work in your Markdown files, enable quickSuggestions
in your User Settings
"[markdown]": {
"editor.quickSuggestions": true
}
See the Changelog
- More Snippets/Completions
- Add syntax highlighting for shortcodes in markdown files.
- Add support for Hugo syntax highlighting in JSON files
Thank you to Matt Stratton for creating the Atom Language-hugo plugin, from which this borrows heavily.
Thank you to Steve Francia, Bjørn Erik and the Hugo community of contributors and users.