Hugo Shortcodes
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Div

Wrap elements in a div and apply specific classes or a style property to it.

How to use

# file.md

Shortcode

# div.html
# new_tab_link.html

<div
{{- if .IsNamedParams -}}
    {{ if .Get `class` }} class="{{ .Get `class` }}"{{ end }}
    {{ if .Get `style` }} style="{{ .Get `style` }}"{{ end }}
{{- else -}}
    {{ if .Get 0 }} class="{{ .Get 0 }}"{{ end }}
{{- end -}}>
    {{ .Inner | markdownify }}
</div>

Sample

💁

Note: according to original author Jim Frenette:

style parameter: since the semicolon declaration separator ; is not permitted, only one declaration allowed

markdown
markdown
markdown


Source