Introduction ============ The Doctrine RST Parser is a PHP library that can parse `reStructuredText `_ documents and render them in HTML or LaTeX. Installation ------------ You can install the Doctrine RST Parser with composer: .. code-block:: console $ composer require doctrine/rst-parser Basic Usage ----------- Here is an example script that demonstrates how to use the RST Parser. Create a file named ``rst-test.php`` in the root of your project and paste the following code: .. code-block:: php require 'vendor/autoload.php'; use Doctrine\RST\Parser; $parser = new Parser(); // RST document $rst = ' Hello world =========== What is it? ---------- This is a **RST** document! Where can I get it? ------------------- You can get it on the `GitHub page `_ '; // Parse it $document = $parser->parse($rst); // Render it echo $document->render(); Now execute the script: .. code-block:: console $ php rst-test.php The above would output the following HTML: .. code-block:: html

Hello world

What is it?

This is a RST document!

Where can I get it?

You can get it on the GitHub page

If you want to render a full HTML document you can do so with the ``renderDocument()`` method: .. code-block:: php echo $document->renderDocument(); The above would output the following: .. code-block:: html

Hello world

What is it?

This is a RST document!

Where can I get it?

You can get it on the GitHub page

If you would like to customize the rendered HTML take a look at the :ref:`Customizing Rendering ` chapter.