Generic HTML Shortcodes

List of generic HTML shortcodes to write HTML in Markdown content.

What’s the Differences Between Shortcodes and Raw HTML?

The difference is that the raw HTML will be omitted by default. For example.

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

The second one <p>Paragraph written in raw HTML.</p> will be omitted, to avoid this, you’ve to either use shortcodes or 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.

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

Shortcuts

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

  • html/div
  • html/p

Examples

Nested Example

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