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:
- Constructs with identical start and end characters:
Use | Sample |
---|---|
| |
| |
| |
|
- Constructs with different start and end characters:
Use | Sample |
---|---|
Hyperlink reference (inline, internal, external, indirect) | Word:
Phrase:
|
Word:
Phrase:
| |
Embedded URI:
Alias:
| |
| |
Footnote reference | Manual numbering:
Automatic numbering:
Automatic symbol generation:
|
| |
Word:
Phrase:
|
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:
- No space may follow the start character
- The end character must not be preceded by a space.
- The start character must start a text block or must be directly preceded by a space or one of the characters - : / ' " < ( [ {.
- The end character must end a text block or it must be directly followed by a space or one of the characters ' " . , : ; ! ? - ) ] } / \ >.
- The end character must be separated from the start character by at least one character.
- 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.
- 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.
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
The backslashes and spaces between "re", "Structured" and "Text" disappear from the edited comment.
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