Skip to content
Snippets Groups Projects
Commit deb78dd0 authored by Gururaj Shetty's avatar Gururaj Shetty
Browse files

Update reStructuredText Basics.rst

parent ba343389
No related branches found
No related tags found
No related merge requests found
Introduction to reStructuredText Introduction to reStructuredText
================================ ################################
What is reStructuredText? What is reStructuredText?
------------------------- *************************
reStructuredText is an easy to read, what-you-see-is-what-you-get plainttext markup syntax and parser system. In other words reStructuredText is a lightweight markup language that is used in static reStructuredText is an easy to read, what-you-see-is-what-you-get plainttext markup syntax and parser system. In other words reStructuredText is a lightweight markup language that is used in static
site generators like Sphinx. It contains robust tools for semantic markup, reusing content, and content filters for different kinds of outputs. site generators like Sphinx. It contains robust tools for semantic markup, reusing content, and content filters for different kinds of outputs.
It’s also easily extendible using custom directives that you can create yourself, allowing you to satisfy a wide variety of documentation needs. It’s also easily extendible using custom directives that you can create yourself, allowing you to satisfy a wide variety of documentation needs.
reStructuredText is useful for creating simple web pages, and for standalone documents. reStructuredText is useful for creating simple web pages, and for standalone documents.
Why use reStructuredText? Why use reStructuredText?
------------------------- *************************
reStructuredText is a lightweight markup language, so it’s easier to read in plain-text format compared to heavier markup languages like DITA and other XML-based formats. reStructuredText is a lightweight markup language, so it’s easier to read in plain-text format compared to heavier markup languages like DITA and other XML-based formats.
You can easily find text editors that render reStructuredText with syntax highlighting and live previews, without having to invest in complex tools. Compared to some other lightweight markup languages You can easily find text editors that render reStructuredText with syntax highlighting and live previews, without having to invest in complex tools. Compared to some other lightweight markup languages
like MarkDown, reStructuredText contains stronger semantic markup tools. Some writers also prefer reStructuredText because the markup standards are more well-defined compared to MarkDown. like MarkDown, reStructuredText contains stronger semantic markup tools. Some writers also prefer reStructuredText because the markup standards are more well-defined compared to MarkDown.
Project setup Project setup
------------- *************
Open this open for complete installation process. Open this open for complete installation process.
`<https://sphinx-rtd-tutorial.readthedocs.io/en/latest/index.html>`_ `<https://sphinx-rtd-tutorial.readthedocs.io/en/latest/index.html>`_
How to use reStructuredText How to use reStructuredText
--------------------------- ***************************
Paragraph Paragraph
######### =========
Paragraphs in reStructuredText are blocks of text separated by at least one blank line. All lines in the paragraph must be indented by the same amount: Paragraphs in reStructuredText are blocks of text separated by at least one blank line. All lines in the paragraph must be indented by the same amount:
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
* Use one asterisk (*text*) for italic * Use one asterisk (*text*) for italic
* Use two asterisks (**text**) for bold * Use two asterisks (**text**) for bold
...@@ -44,7 +44,7 @@ Paragraphs in reStructuredText are blocks of text separated by at least one blan ...@@ -44,7 +44,7 @@ Paragraphs in reStructuredText are blocks of text separated by at least one blan
* Use two backticks (``text``) for code sample * Use two backticks (``text``) for code sample
Headers Headers
####### =======
Headers are demarcated by non-alphanumeric characters like dashes, equal signs, or tildes. Use the same character for headers at the same level. The following creates a header: Headers are demarcated by non-alphanumeric characters like dashes, equal signs, or tildes. Use the same character for headers at the same level. The following creates a header:
...@@ -58,43 +58,43 @@ Headers are demarcated by non-alphanumeric characters like dashes, equal signs, ...@@ -58,43 +58,43 @@ Headers are demarcated by non-alphanumeric characters like dashes, equal signs,
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
Heading one Heading one
=========== ###########
Heading two Heading two
----------- ***********
Heading three Heading three
############# =============
Heading four Heading four
************ ------------
*Output* *Output*
Heading one Heading one
=========== ###########
Heading two Heading two
----------- ***********
Heading three Heading three
############# =============
Heading four Heading four
************ ------------
List List
#### ====
For creating list just place an asterisk(*) or hyphen (-) at the start of a paragraph and indent continuation lines with one space. The same goes for numbered lists; they can also be autonumbered using a (#) sign: For creating list just place an asterisk(*) or hyphen (-) at the start of a paragraph and indent continuation lines with one space. The same goes for numbered lists; they can also be autonumbered using a (#) sign:
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
* This is a bulleted list. * This is a bulleted list.
* It has two items, the second * It has two items, the second
...@@ -120,13 +120,13 @@ For creating list just place an asterisk(*) or hyphen (-) at the start of a para ...@@ -120,13 +120,13 @@ For creating list just place an asterisk(*) or hyphen (-) at the start of a para
Images Images
###### ======
reST supports an image directive: reST supports an image directive:
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
.. figure:: /images/multi data.png .. figure:: /images/multi data.png
...@@ -136,16 +136,16 @@ reST supports an image directive: ...@@ -136,16 +136,16 @@ reST supports an image directive:
Tables Tables
###### ======
The "list-table" directive is used to create a table from data in a uniform two-level bullet list. "Uniform" means that each sublist (second-level list) must contain the same number of list items: The "list-table" directive is used to create a table from data in a uniform two-level bullet list. "Uniform" means that each sublist (second-level list) must contain the same number of list items:
Simple table Simple table
************ ------------
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
===== ===== ======= ===== ===== =======
A B A and B A B A and B
...@@ -168,11 +168,11 @@ True True True ...@@ -168,11 +168,11 @@ True True True
===== ===== ======= ===== ===== =======
Grid tabble Grid tabble
*********** -----------
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
+------------------------+------------+----------+----------+ +------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 | | Header row, column 1 | Header 2 | Header 3 | Header 4 |
...@@ -197,16 +197,16 @@ Grid tabble ...@@ -197,16 +197,16 @@ Grid tabble
Two more syntaxes are supported: CSV tables and List tables `<https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table>`_. Two more syntaxes are supported: CSV tables and List tables `<https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table>`_.
Hyperlinks Hyperlinks
---------- ==========
External External
******** --------
If the link is provided for any website then use this syntax: If the link is provided for any website then use this syntax:
*Syntax* *Syntax*
.. code-block:: .. code-block:: console
`<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks>`_ `<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks>`_
...@@ -215,19 +215,19 @@ If the link is provided for any website then use this syntax: ...@@ -215,19 +215,19 @@ If the link is provided for any website then use this syntax:
`<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks>`_ `<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks>`_
Internal Internal
******** --------
Internal linking is done via a special reST role provided by Sphinx, Cross-referencing syntax `<https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#ref-role>`_. Internal linking is done via a special reST role provided by Sphinx, Cross-referencing syntax `<https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#ref-role>`_.
Roles Roles
----- =====
Math Math
**** ----
*Syntax* *Syntax*
.. code-block::gbv .. code-block:: console
Since Pythagoras, we know that :math:`a^2 + b^2 = c^2` Since Pythagoras, we know that :math:`a^2 + b^2 = c^2`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment