Formatting

Titles

reStructuredText supports multiple levels of section titles, each with its own unique underline style. The following are the most common styles:

  • = for top-level titles

  • - for second-level titles

  • ^ for third-level titles

  • " for fourth-level titles

  • ' for fifth-level titles

  • ~ for sixth-level titles

Example:

==============
Title Level 1
==============

Subtitle Level 2
=================

Section Level 3
----------------

Subsection Level 4
~~~~~~~~~~~~~~~~~~~

Subsubsection Level 5
^^^^^^^^^^^^^^^^^^^^^^

Paragraph Level 6
""""""""""""""""""

Paragraphs

Paragraphs are created by writing text without any special formatting. A blank line separates paragraphs.

Example:

This is a paragraph. It contains multiple sentences.

This is another paragraph.

Lists

There are two types of lists in reStructuredText: ordered and unordered.

Unordered lists use asterisks, plus signs, or hyphens:

Example

Syntax

  • Item 1

  • Item 2

    • Subitem 1

    • Subitem 2

- Item 1
- Item 2

  - Subitem 1
  - Subitem 2
  1. First item

  2. Second item

    1. Subitem 1

    2. Subitem 2

1. First item
2. Second item

   1. Subitem 1
   2. Subitem 2

Inline Markup

Inline markup is used to apply formatting to text within a paragraph.

  • Bold: Use double asterisks: **bold text**

  • Italic: Use single asterisks: *italic text*

  • Inline code: Use double backticks: `` inline code ``

Images

Syntax

Example

.. image:: example-vector.svg
   :alt: Logo
   :width: 200px
Simple image

Relative URIs

Image URIs are relative to the document. If it's the same folder, just write the image name with the extension. To target the file in another folder, use the path to the file with eventual leading dot.

Syntax

Example

.. figure::
   ../devsite-manual/
   AtoMik-Portal-NEW-Mockup-
   1536x864.jpg
   :alt: Image in a subfolder
   :width: 100%
Image in a subfolder

Result

Literal Blocks

Literal blocks are used to include preformatted text in your document. They are useful for including code snippets, command-line output, or any other text that should be displayed exactly as written, without any reStructuredText formatting applied.

To create a literal block, start a paragraph with "::" followed by a blank line. The text that follows will be included in the literal block.

Example:

::

   This is a literal block.
   It preserves whitespace and
   line breaks exactly as written.

Result:

This is a literal block.
It preserves whitespace and
line breaks exactly as written.

Example:

def hello_world():
   print("Hello, world!")

Code Blocks with Syntax Highlighting

The code-block directive is used to include code snippets with syntax highlighting. Specify the language after code-block:: to enable appropriate highlighting.

.. code-block:: csharp

   using System;

   class Program
   {
      static void Main()
      {
         Console.WriteLine("Hello, world!");
      }
   }

Python Result:

def hello_world():
    print("Hello, world!")

JavaScript Result:

function helloWorld() {
    console.log("Hello, world!");
}

C# Result:

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, world!");
    }
}

Tables

Simple tables can be created using the following syntax:

Example:

+-----------+-----------+
| Header 1  | Header 2  |
+===========+===========+
| Cell 1    | Cell 2    |
+-----------+-----------+
| Cell 3    | Cell 4    |
+-----------+-----------+

Result:

Header 1

Header 2

Cell 1

Cell 2

Cell 3

Cell 4