Inline markup

Inline markups are used in reStructuredText to mark words or phrases within a text block. Words and phrases can thus be formatted or provided with a function.

Inline markups consist of a start and end character, which enclose the word or phrase in question.

Use

Inline markups are used for the following constructs:

Use

Sample

Highlighted text (italic)

*emphasized text*

Highlighted text (bold)

**strong text**

Inline literals (monospaced font)

``inline literals``

Substitution references

|substitution reference|

Use

Sample

Hyperlink reference (inline, internal, external, indirect)

(Hyperlinks)

Word:

Target_

Phrase:

`Hyperlink target`_

Anonymous hyperlink reference

Word:

Target__

Phrase:

`Hyperlink target`__

Embedded URIs and aliases

Embedded URI:

`Beckhoff home page <http://www.beckhoff.de>`_

Alias:

`link <Beckhoff home page_>`_

Standalone hyperlinks

http://www.beckhoff.de
support@beckhoff.com

Footnote reference

(Footnotes)

Manual numbering:

[1]_

Automatic numbering:

[#]_

Automatic symbol generation:

[*]_

Quote reference

[CIT]_

Inline hyperlinks

Word:

_Inline-hyperlink-target

Phrase:

_`Inline target`

Rules for inline markup detection

Inline markups cannot be nested. Start and end characters of inline markups are only recognized if the following conditions are met:

  1. No space may follow the start character
  2. The end character must not be preceded by a space.
  3. The start character must start a text block or must be directly preceded by a space or one of the characters - : / ' " < ( [ {.
  4. The end character must end a text block or it must be directly followed by a space or one of the characters ' " . , : ; ! ? - ) ] } / \ >.
  5. The end character must be separated from the start character by at least one character.
  6. Neither the start nor the end character may be preceded by a backslash (except the end character of inline literals). A backslash preceding a start or end character disables markup detection, except for the end character of inline literals.
  7. If a start character is directly preceded by one of the characters ' " ( [ { <, the corresponding character ' " ) ] } > must not follow directly (not possible: "*"text"*", possible: (*(text)*)).

Inline markup at character level

It is possible to mark individual characters within a word with a backslash, so that any text can follow immediately after the inline markup.

Python ``list``\s use square bracket syntax.

Inline markup 1:

The backslash disappears from the edited document. The word "list" appears in monospaced font, and the letter "s" follows immediately as normal text, without space.

Any text can be prepended to the inline markup by using backslashes and spaces.

Possible in *re*\ ``Structured``\ *Text*, though not encouraged

Inline markup 2:

The backslashes and spaces between "re", "Structured" and "Text" disappear from the edited comment.

Inline markup 3:

It is not recommended to use backslash for inline markings at the character level. Such use makes it difficult to read the unprocessed comment. Use this function sparingly and only where it is absolutely necessary.

See also: Escaping mechanism