# MyST Syntax Overview

MyST (Markedly Structured Text) is designed to create publication-quality documents written entirely in Markdown. The extensions and design of MyST is inspired by the Sphinx and ReStructured Text (RST) ecosystems.

MyST is a superset of , the standard form of Markdown, and allows you to directly create “directives” and “roles” that extend markdown to support technical and scientific documents. directives are block-level extension points, like , , or ; and roles are inline extension points, for components like , , , or .

## Directives & Roles¶

Roles and directives are two of the most powerful parts of MyST. They are kind of like functions, but written in a markup language. They both serve a similar purpose, but roles are written in one line whereas directives span many lines. They both accept different kinds of inputs, and what they do with those inputs depends on the specific role or directive being used.

### Directives¶

Directives are multi-line containers that include an identifier, arguments, options, and content. Examples include , , and . At its simplest, you can use directives using a "fence" (either back-ticks or colons) and the name of the directive enclosed in braces ({name}):

Colon Fence
Backtick Fence

Use a colon fence (:::) when the contents of the directive is markdown, such as this will improve the processing in renderers that do not support MyST:

The {note} directive above doesn't take any arguments and we didn't add any options. In addition to the directive name and the directive content, directives allow two other configuration points:

1) directive arguments - a list of words that come just after the {directivename}.

Colon Fence
Backtick Fence
:::{directivename} arg1 arg2
My directive content.
:::

2) directive options - a collection of flags or key/value pairs that come just underneath {directivename}.

There are two ways to write directive options, as :key: value or as a YAML block.

Key value pairs
YAML

Options can be included as :key: val pairs, which is the default way to include options.

{directivename}

My directive content.


### Roles¶

Roles are very similar to directives, but they are written entirely in one line. The syntax of a role is:

Some content {rolename}and here is my role's content!

Of course, roles will only work if rolename is a valid role name! The abbr role creates inline abbreviations, for example, {abbr}MyST (Markedly Structured Text) will become MyST! When you hover over the abbreviation you will see the title appear!

Roles are defined inline, with an identifier and input. There are a number of roles included in MyST, including abbreviations, subscript, and superscript, as well as inline . Unknown roles will still be parsed as well:

## Nesting content blocks in Markdown¶

If you’d like to nest content blocks inside one another in Markdown (for example, to put a {note} inside of a {margin}), you may do so by adding extra backticks (`) to the outer-most block. For example, two nested in side of each other:

This works for literal code blocks as well. For example, to show triple-backticks on this page we are using following syntax: