The RST inline markup

Within most blocks of text, we can include inline markup. We can't include inline markup in the code samples or doctest blocks. Note that we cannot nest inline markup, either.

The RST inline markup includes a variety of common ASCII treatments of text. For example, we have *emphasis* and **strong emphasis**, which will usually produce italic and bold, respectively. We may want to emphasize code segments within a block of text; we use ``literal`` to force a monospaced font.

We can also include cross-references as the inline markup. A trailing _ indicates a reference, and it points away from the preceding words; a leading _ indicates a target, and it points toward the following words. For example, we might have `some phrase`_ as a reference. We can then use _`some phrase` as the target for that reference. We don't need to provide explicit targets for section titles: we can reference `This Is A Heading`_ because all the section titles are already defined as targets. For the HTML output, this will generate the expected <a> tags. For the PDF output, in-text links will be generated.

We cannot nest inline markup. There's little need for nested inline markup; too many typographic tricks devolve to visual clutter. If our writing is so sensitive to typography, we should probably use LaTeX directly.

Inline markup can also have explicit role indicators; this is :role:, followed by `text`. Simple RST has relatively few roles. We might use :code:`some code` to be more explicit regarding the presence of a code sample in the text. When we look at Sphinx, there are numerous role indicators. The use of explicit roles can provide a great deal of semantic information.

When doing things that have more complex math, we might use the LaTeX math typesetting capabilities. This uses the :math: role; it looks like this: :math:`a=pi r^2`

Roles are open-ended. We can provide a configuration to docutils that adds new roles. This is done by means of tools such as Sphinx. 

In addition to inline role definitions, RST has a number of directives. In the next section, we'll look at these directives.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset