Skip to article frontmatterSkip to article content

Use roles and directives

Use a basic directive

Here’s the basic usage of a directive, including arguments, options, and content:

:::{my-directive} my-arg
:option: my-option

My directive content.
:::

Attach a class to directives

Any directive can have classes attached to HTML outputs by using the class option like so:

:::{my-directive} 
:class: classone classtwo
:::

These will be passed directly to the list of classes on the HTML element, so the value of :class: should follow the HTML specification for the class attribute.

Use a basic role

Here’s the basic way to write a role in MyST Markdown:

mypage.md
Here is a role: {my-role}`some content`.