| Server IP : 82.148.16.210 / Your IP : 216.73.216.249 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/usr/share/doc/python3-docutils/docs/ref/rst/ |
Upload File : |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>reStructuredText Interpreted Text Roles</title>
<meta name="author" content="David Goodger" />
<meta name="date" content="2022-04-02" />
<meta name="copyright" content="This document has been placed in the public domain." />
<link rel="stylesheet" href="../../../css/html4css1.css" type="text/css" />
</head>
<body>
<div class="header">
<a class="reference external" href="https://docutils.sourceforge.io">Docutils</a> | <a class="reference external" href="../../index.html">Overview</a> | <a class="reference external" href="../../index.html#project-fundamentals">About</a> | <a class="reference external" href="../../index.html#user">Users</a> | <a class="reference external" href="../../index.html#ref">Reference</a> | <a class="reference external" href="../../index.html#howto">Developers</a>
<hr class="header"/>
</div>
<div class="document" id="restructuredtext-interpreted-text-roles">
<h1 class="title">reStructuredText Interpreted Text Roles</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>David Goodger</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:docutils-develop@lists.sourceforge.net">docutils-develop@lists.sourceforge.net</a></td></tr>
<tr><th class="docinfo-name">Revision:</th>
<td>9051</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2022-04-02</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>This document has been placed in the public domain.</td></tr>
</tbody>
</table>
<!-- Minimal menu bar for inclusion in documentation sources
in ``docutils/docs/*/`` sub-sub-diretories.
Attention: this is not a standalone document. -->
<p>This document describes the interpreted text roles implemented in the
reference reStructuredText parser.</p>
<p>Interpreted text uses backquotes (`) around the text. An explicit
role marker may optionally appear before or after the text, delimited
with colons. For example:</p>
<pre class="literal-block">
This is `interpreted text` using the default role.
This is :title:`interpreted text` using an explicit role.
</pre>
<p>A default role may be defined by applications of reStructuredText; it
is used if no explicit <tt class="docutils literal">:role:</tt> prefix or suffix is given. The
"default default role" is <a class="reference internal" href="#title-reference">:title-reference:</a>. It can be changed
using the <a class="reference external" href="directives.html#default-role">default-role</a> directive.</p>
<p>See the <a class="reference external" href="restructuredtext.html#interpreted-text">Interpreted Text</a> section in the <a class="reference external" href="restructuredtext.html">reStructuredText Markup
Specification</a> for syntax details. For details on the hierarchy of
elements, please see <a class="reference external" href="../doctree.html">The Docutils Document Tree</a> and the <a class="reference external" href="../docutils.dtd">Docutils
Generic DTD</a> XML document type definition. For interpreted text role
implementation details, see <a class="reference external" href="../../howto/rst-roles.html">Creating reStructuredText Interpreted
Text Roles</a>.</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#customization" id="toc-entry-1">Customization</a></li>
<li><a class="reference internal" href="#standard-roles" id="toc-entry-2">Standard Roles</a><ul>
<li><a class="reference internal" href="#emphasis" id="toc-entry-3"><tt class="docutils literal">:emphasis:</tt></a></li>
<li><a class="reference internal" href="#literal" id="toc-entry-4"><tt class="docutils literal">:literal:</tt></a></li>
<li><a class="reference internal" href="#code" id="toc-entry-5"><tt class="docutils literal">:code:</tt></a></li>
<li><a class="reference internal" href="#math" id="toc-entry-6"><tt class="docutils literal">:math:</tt></a></li>
<li><a class="reference internal" href="#pep-reference" id="toc-entry-7"><tt class="docutils literal"><span class="pre">:pep-reference:</span></tt></a></li>
<li><a class="reference internal" href="#rfc-reference" id="toc-entry-8"><tt class="docutils literal"><span class="pre">:rfc-reference:</span></tt></a></li>
<li><a class="reference internal" href="#strong" id="toc-entry-9"><tt class="docutils literal">:strong:</tt></a></li>
<li><a class="reference internal" href="#subscript" id="toc-entry-10"><tt class="docutils literal">:subscript:</tt></a></li>
<li><a class="reference internal" href="#superscript" id="toc-entry-11"><tt class="docutils literal">:superscript:</tt></a></li>
<li><a class="reference internal" href="#title-reference" id="toc-entry-12"><tt class="docutils literal"><span class="pre">:title-reference:</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#specialized-roles" id="toc-entry-13">Specialized Roles</a><ul>
<li><a class="reference internal" href="#raw" id="toc-entry-14"><tt class="docutils literal">raw</tt></a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="customization">
<h1><a class="toc-backref" href="#toc-entry-1">Customization</a></h1>
<p>Custom interpreted text roles may be defined in a document with the
<a class="reference external" href="directives.html#role">"role" directive</a>. Customization details are listed with each role.</p>
<p id="class">A <tt class="docutils literal">class</tt> option is recognized by the "role" directive for most
interpreted text roles. A <a class="reference external" href="directives.html#role-class">description</a> is provided in the <a class="reference external" href="directives.html#role">"role"
directive</a> documentation.</p>
</div>
<div class="section" id="standard-roles">
<h1><a class="toc-backref" href="#toc-entry-2">Standard Roles</a></h1>
<div class="section" id="emphasis">
<h2><a class="toc-backref" href="#toc-entry-3"><tt class="docutils literal">:emphasis:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">emphasis</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Implements emphasis. These are equivalent:</p>
<pre class="literal-block">
*text*
:emphasis:`text`
</pre>
</div>
<div class="section" id="literal">
<h2><a class="toc-backref" href="#toc-entry-4"><tt class="docutils literal">:literal:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">literal</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Implements inline literal text. These are equivalent:</p>
<pre class="literal-block">
``text``
:literal:`text`
</pre>
<p>Care must be taken with backslash-escapes though. These are <em>not</em>
equivalent:</p>
<pre class="literal-block">
``text \ and \ backslashes``
:literal:`text \ and \ backslashes`
</pre>
<p>The backslashes in the first line are preserved (and do nothing),
whereas the backslashes in the second line escape the following
spaces.</p>
</div>
<div class="section" id="code">
<h2><a class="toc-backref" href="#toc-entry-5"><tt class="docutils literal">:code:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">literal</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>, language</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>(New in Docutils 0.9.)</p>
<p>The <tt class="docutils literal">code</tt> role marks its content as code in a formal language.</p>
<p>For syntax highlight of inline code, the <a class="reference external" href="directives.html#role">"role" directive</a> can be used to
build custom roles with the code language specified in the "language"
option.</p>
<p>For example, the following creates a LaTeX-specific "latex" role:</p>
<pre class="literal-block">
.. role:: latex(code)
:language: latex
</pre>
<p>Content of the new role is parsed and tagged by the <a class="reference external" href="https://pygments.org/">Pygments</a> syntax
highlighter. See the <a class="reference external" href="directives.html#code">code directive</a> for more info on parsing and display
of code in reStructuredText.</p>
<p>In addition to "<a class="reference internal" href="#class">class</a>", the following option is recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">language</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>Name of the code's language.
See <a class="reference external" href="https://pygments.org/languages/">supported languages and markup formats</a> for recognized values.</dd>
</dl>
</div>
<div class="section" id="math">
<h2><a class="toc-backref" href="#toc-entry-6"><tt class="docutils literal">:math:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">math</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a></td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>(New in Docutils 0.8.)</p>
<p>The <tt class="docutils literal">math</tt> role marks its content as mathematical notation (inline
formula).</p>
<p>The input format is LaTeX math syntax without the “math delimiters“
(<tt class="docutils literal">$ $</tt>), for example:</p>
<pre class="literal-block">
The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`.
</pre>
<p>See the <a class="reference external" href="directives.html#math">math directive</a> (producing display formulas) for more info
on mathematical notation in reStructuredText.</p>
</div>
<div class="section" id="pep-reference">
<h2><a class="toc-backref" href="#toc-entry-7"><tt class="docutils literal"><span class="pre">:pep-reference:</span></tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first"><tt class="docutils literal">:PEP:</tt></p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">reference</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">:pep-reference:</span></tt> role is used to create an HTTP reference to a
PEP (Python Enhancement Proposal). The <tt class="docutils literal">:PEP:</tt> alias is usually
used. The content must be a number, for example:</p>
<pre class="literal-block">
See :PEP:`287` for more information about reStructuredText.
</pre>
<p>This is equivalent to:</p>
<pre class="literal-block">
See `PEP 287`__ for more information about reStructuredText.
__ https://peps.python.org/pep-0287
</pre>
</div>
<div class="section" id="rfc-reference">
<h2><a class="toc-backref" href="#toc-entry-8"><tt class="docutils literal"><span class="pre">:rfc-reference:</span></tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first"><tt class="docutils literal">:RFC:</tt></p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">reference</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">:rfc-reference:</span></tt> role is used to create an HTTP reference to an
RFC (Internet Request for Comments). The <tt class="docutils literal">:RFC:</tt> alias is usually
used. The content must be a number <a class="footnote-reference" href="#footnote-1" id="footnote-reference-1">[1]</a>, for example:</p>
<pre class="literal-block">
See :RFC:`2822` for information about email headers.
</pre>
<p>This is equivalent to:</p>
<pre class="literal-block">
See `RFC 2822`__ for information about email headers.
__ https://tools.ietf.org/html/rfc2822.html
</pre>
<table class="docutils footnote" frame="void" id="footnote-1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-1">[1]</a></td><td><p class="first">You can link to a specific section by saying
<tt class="docutils literal"><span class="pre">:rfc:`number#anchor`</span></tt>. (New in Docutils 0.15.)</p>
<div class="admonition warning last">
<p class="first admonition-title">Warning</p>
<p>The anchor (anything following a <tt class="docutils literal">#</tt>) is appended to
the reference without any checks and not shown in the link text.</p>
<p class="last">It is recommended to use <a class="reference external" href="restructuredtext.html#hyperlink-references">hyperlink references</a> for
anything more complex than a single RFC number.</p>
</div>
</td></tr>
</tbody>
</table>
</div>
<div class="section" id="strong">
<h2><a class="toc-backref" href="#toc-entry-9"><tt class="docutils literal">:strong:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">strong</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Implements strong emphasis. These are equivalent:</p>
<pre class="literal-block">
**text**
:strong:`text`
</pre>
</div>
<div class="section" id="subscript">
<h2><a class="toc-backref" href="#toc-entry-10"><tt class="docutils literal">:subscript:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first"><tt class="docutils literal">:sub:</tt></p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">subscript</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Implements subscripts.</p>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p>Whitespace or punctuation is required around interpreted text, but
often not desired with subscripts & superscripts.
Backslash-escaped whitespace can be used; the whitespace will be
removed from the processed document:</p>
<pre class="literal-block">
H\ :sub:`2`\ O
E = mc\ :sup:`2`
</pre>
<p>In such cases, readability of the plain text can be greatly
improved with substitutions:</p>
<pre class="literal-block">
The chemical formula for pure water is |H2O|.
.. |H2O| replace:: H\ :sub:`2`\ O
</pre>
<p class="last">See <a class="reference external" href="restructuredtext.html">the reStructuredText spec</a> for further information on
<a class="reference external" href="restructuredtext.html#character-level-inline-markup">character-level markup</a> and <a class="reference external" href="restructuredtext.html#substitution-references">the substitution mechanism</a>.</p>
</div>
</div>
<div class="section" id="superscript">
<h2><a class="toc-backref" href="#toc-entry-11"><tt class="docutils literal">:superscript:</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first"><tt class="docutils literal">:sup:</tt></p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">superscript</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Implements superscripts. See the tip in <a class="reference internal" href="#subscript">:subscript:</a> above.</p>
</div>
<div class="section" id="title-reference">
<h2><a class="toc-backref" href="#toc-entry-12"><tt class="docutils literal"><span class="pre">:title-reference:</span></tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first"><tt class="docutils literal">:title:</tt>, <tt class="docutils literal">:t:</tt>.</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">title_reference</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>.</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">:title-reference:</span></tt> 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".</p>
<p>Since title references are typically rendered with italics, they are
often marked up using <tt class="docutils literal">*emphasis*</tt>, which is misleading and vague.
The "title_reference" element provides accurate and unambiguous
descriptive markup.</p>
<p>Let's assume <tt class="docutils literal"><span class="pre">:title-reference:</span></tt> is the default interpreted text
role (see below) for this example:</p>
<pre class="literal-block">
`Design Patterns` [GoF95]_ is an excellent read.
</pre>
<p>The following document fragment (<a class="reference external" href="../doctree.html#pseudo-xml">pseudo-XML</a>) will result from
processing:</p>
<pre class="literal-block">
<paragraph>
<title_reference>
Design Patterns
<citation_reference refname="gof95">
GoF95
is an excellent read.
</pre>
<p><tt class="docutils literal"><span class="pre">:title-reference:</span></tt> 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 <tt class="docutils literal"><span class="pre">:title-reference:</span></tt> role
must be used to obtain a <tt class="docutils literal">title_reference</tt> element.</p>
</div>
</div>
<div class="section" id="specialized-roles">
<h1><a class="toc-backref" href="#toc-entry-13">Specialized Roles</a></h1>
<div class="section" id="raw">
<h2><a class="toc-backref" href="#toc-entry-14"><tt class="docutils literal">raw</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Aliases:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field"><th class="field-name">DTD Element:</th><td class="field-body"><p class="first">raw</p>
</td>
</tr>
<tr class="field"><th class="field-name">Customization:</th><td class="field-body"><table class="first last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Options:</th><td class="field-body"><a class="reference internal" href="#class">class</a>, format</td>
</tr>
<tr class="field"><th class="field-name">Content:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>The "raw" role is a stop-gap measure allowing the author to bypass
reStructuredText's markup. It is a "power-user" feature that
should not be overused or abused. The use of "raw" ties documents
to specific output formats and makes them less portable.</p>
<p class="last">If you often need to use "raw"-derived interpreted text roles or
the "raw" directive, that is a sign either of overuse/abuse or that
functionality may be missing from reStructuredText. Please
describe your situation in a message to the <a class="reference external" href="../../user/mailing-lists.html#docutils-user">Docutils-users</a> mailing
list.</p>
</div>
<p>The "raw" role indicates non-reStructuredText data that is to be
passed untouched to the Writer. It is the inline equivalent of the
<a class="reference external" href="directives.html#raw-directive">"raw" directive</a>; see its documentation for details on the
semantics.</p>
<p>The "raw" role cannot be used directly. The <a class="reference external" href="directives.html#role">"role" directive</a> must
first be used to build custom roles based on the "raw" role. One or
more formats (Writer names) must be provided in a "format" option.</p>
<p>For example, the following creates an HTML-specific "raw-html" role:</p>
<pre class="literal-block">
.. role:: raw-html(raw)
:format: html
</pre>
<p>This role can now be used directly to pass data untouched to the HTML
Writer. For example:</p>
<pre class="literal-block">
If there just *has* to be a line break here,
:raw-html:`<br />`
it can be accomplished with a "raw"-derived role.
But the line block syntax should be considered first.
</pre>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p class="last">Roles based on "raw" should clearly indicate their origin, so
they are not mistaken for reStructuredText markup. Using a "raw-"
prefix for role names is recommended.</p>
</div>
<p>In addition to "<a class="reference internal" href="#class">class</a>", the following option is recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">format</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>One or more space-separated output format names (Writer names).</dd>
</dl>
</div>
</div>
</div>
</body>
</html>