reStructuredText Interpreted Text Roles

Author: David Goodger
Contact: goodger@users.sourceforge.net
Revision: 1.6
Date: 2003-06-09
Copyright: This document has been placed in the public domain.

This document describes the interpreted text roles implemented in the reference reStructuredText parser.

Interpreted text uses backquotes (`) around the text. An explicit role marker may optionally appear before or after the text, delimited with colons. For example:

This is `interpreted text` using the default role.

This is :title:`interpreted text` using an explicit role.

A default role may be defined by applications of reStructuredText; it is used if no explicit :role: prefix or suffix is given. The "default default role" is :title-reference:.

See the Interpreted Text section in the reStructuredText Markup Specification for syntax details.

Contents

:emphasis:

Aliases:None
DTD Element:emphasis

Implements emphasis. These are equivalent:

*text*
:emphasis:`text`

:literal:

Aliases:None
DTD Element:literal

Implements inline literal text. These are equivalent:

``text``
:literal:`text`

Care must be taken with backslash-escapes though. These are not equivalent:

``text \ and \ backslashes``
:literal:`text \ and \ backslashes`

The backslashes in the first line are preserved (and do nothing), whereas the backslashes in the second line escape the following spaces.

:pep-reference:

Aliases::PEP:
DTD Element:reference

The :pep-reference: role is used to create an HTTP reference to a PEP (Python Enhancement Proposal). The :PEP: alias is usually used. For example:

See :PEP:`287` for more information about reStructuredText.

This is equivalent to:

See `PEP 287`__ for more information about reStructuredText.

__ http://www.python.org/peps/pep-0287.html

:rfc-reference:

Aliases::RFC:
DTD Element:reference

The :rfc-reference: role is used to create an HTTP reference to an RFC (Internet Request for Comments). The :RFC: alias is usually used. For example:

See :RFC:`2822` for information about email headers.

This is equivalent to:

See `RFC 2822`__ for information about email headers.

__ http://www.faqs.org/rfcs/rfc2822.html

:strong:

Aliases:None
DTD Element:strong

Implements strong emphasis. These are equivalent:

**text**
:strong:`text`

:subscript:

Aliases::sub:
DTD Element:subscript

Implements subscripts.

:superscript:

Aliases::sup:
DTD Element:superscript

Implements superscripts.

:title-reference:

Aliases::title:, :t:.
DTD Element:title_reference

The :title-reference: role is used to describe the titles of books, periodicals, and other materials. It is the equivalent of the HTML "cite" element, and it is expected that HTML writers will typically render "title_reference" elements using "cite".

Since title references are typically rendered with italics, they are often marked up using *emphasis*, which is misleading and vague. The "title_reference" element provides accurate and unambiguous descriptive markup.

Let's assume :title-reference: is the default interpreted text role (see below) for this example:

`Design Patterns` [GoF95]_ is an excellent read.

The following document fragment (pseudo-XML) will result from processing:

<paragraph>
    <title_reference>
        Design Patterns

    <citation_reference refname="gof95">
        GoF95
     is an excellent read.

:title-reference: is the default interpreted text role in the standard reStructuredText parser. This means that no explicit role is required. Applications of reStructuredText may designate a different default role, in which case the explicit role must be used.