Here’s a cheat sheet for RST (reStructuredText), a lightweight markup language commonly used for writing documentation:
Headings
Heading 1
=========
Heading 2
---------
Emphasis
*italic* or _italic_
**bold** or __bold__
Lists
Bullet Points:
- Item 1
- Item 2
- Subitem
Numbered:
1. First
2. Second
a. Subitem
Links
`Link Text <https://example.com>`_
Images
.. image:: image.jpg
:width: 400
:alt: Alternative Text
Code Blocks
Inline Code:
``inline code``
Block Code:
.. code-block:: python
def hello():
print("Hello, world!")
Tables
+-------------+-------------+
| Column 1 | Column 2 |
+=============+=============+
| Row 1, Col 1| Row 1, Col 2|
+-------------+-------------+
| Row 2, Col 1| Row 2, Col 2|
+-------------+-------------+
Quotes
This is a block quote.
Sections and Sidebar
.. rubric:: Important Section
.. sidebar:: Sidebar Content
:title: Sidebar Title
:class: important
Content of the sidebar.
Footnotes
.. [1] This is a footnote.
Admonitions
.. note::
This is a note.
.. warning::
This is a warning.
Directives
.. toctree::
:maxdepth: 2
:caption: Table of Contents
chapter1.rst
chapter2.rst
Roles
:doc:`Link Text <chapter1>`
:ref:`Reference Text <label>`
Line Blocks
| This is a line block.
| It preserves line breaks.
Substitutions
.. |replacement| image:: replacement.jpg
This cheat sheet covers some of the basic elements and formatting in reStructuredText.