HTML Shortcodes

Donate

Become a backer or sponsor to support our work.

Sponsors

The guide shows how to usee the HTML shortcodes to write HTML.

What’s the Difference

The difference is that the HTML written in shortcodes will not be omitted when markup.goldmark.renderer.unsafe is false. For example.

1{{< html/p >}}Paragraph written in shortcode.{{< /html/p >}}
2
3<p>Paragraph written in raw HTML.</p>

Paragraph written in shortcode.

Paragraph written in raw HTML.

To get avoid omitting the raw HTML, you’ve to enable the markup.goldmark.renderer.unsafe.

Shortcodes

html/tag

The html/tag shortcode can be used to generate any HTML elements, it takes the _name as the HTML element name, such as div, p and so on. The other named parameters will be treated as element’s attributes.

1{{< html/tag _name=[name] [attr]=[val] >}}
2BODY
3{{< /html/tag >}}

html/void

Similar to the html/tag shortcode, html/void for generating void HTML elements, such as the input element.

1{{< html/void _name=[name] [attr]=[val] >}}

For example.

1{{< html/void _name=input type=password placeholder="Please enter the password" class="form-control mb-3" >}}

Others

This module also ships with some handy shortcodes that don’t require the _name parameter.

Name
html/div
html/p

Nested Example

1{{< html/tag _name=div class="mb-3 text-center" >}}
2{{< html/void _name=input name=name placeholder=Name >}}
3{{< /html/tag >}}