Roles in MyST

The MyST forms of the specimens on Roles, each rendered live by this page’s own Markdown parser. Its custom roles carry names of their own.

Text styling roles

Text styling roles

{emphasis}`Emphasis`, {strong}`strong`, {literal}`literal` and {code}`code`;
H{sub}`2`O and E = mc{sup}`2`;
{title-reference}`The Book of Roles`,
{abbreviation}`approx.` and {acronym}`NASA`.

Emphasis, strong, literal and code; H2O and E = mc2; The Book of Roles, approx. and NASA.

UI and file roles

Keys, labels and menus

Press {kbd}`Ctrl+S`, or choose {menuselection}`File --> Save As...`
and click {guilabel}`&Save`.

Press Ctrl+S, or choose File ‣ Save As… and click Save.

Files, commands and terms

Edit {file}`~/.config/{project}/ubproject.toml`,
then run {samp}`ubc build {builder}`.
The {command}`ubc` command, or {program}`ubc`, reads {makevar}`PATH`.
A {dfn}`specimen` shows its source and its result;
this page is {mimetype}`text/html`,
a label here matches {regexp}`^ex-roles-[a-z]+$`,
and a stack is {abbr}`LIFO (last in, first out)`.
See {manpage}`ls(1)`, the {mailheader}`Content-Type` header
and {newsgroup}`comp.lang.python`.

Edit ~/.config/project/ubproject.toml, then run ubc build builder. The ubc command, or ubc, reads PATH. A specimen shows its source and its result; this page is text/html, a label here matches ^ex-roles-[a-z]+$, and a stack is LIFO. See ls(1), the Content-Type header and comp.lang.python.

Badges

Badges

{bdg-primary}`primary`, {bdg-info-line}`outlined`,
and {bdg-ref-success}`a link to this page <authoring:roles>`.

primary, outlined, and a link to this page.

Custom roles

A custom role

```{role} ex-roles-myst-flag
```

A {ex-roles-myst-flag}`flagged` word carries the class `ex-roles-myst-flag`.

A flagged word carries the class ex-roles-myst-flag.

Highlighted inline code

Highlighted inline code

```{role} ex-roles-myst-python(code)
:language: python
```

In Python, {ex-roles-myst-python}`len("abc") + 2`
is {ex-roles-myst-python}`5`.

In Python, len("abc") + 2 is 5.