PHP code example of dusta / rst

1. Go to this page and download the library: Download dusta/rst library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dusta / rst example snippets




$parser = new Dusta\RST\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 <https://github.com/Gregwar/RST>`_';

// Parse it
$parser = $parser->parse($rst);
$head = array();
foreach ($parser->headerNodes as $node) {
    $headers[] = $node->render();
}

$headers = $document; // array
$content = $parser->render(); // string

echo '<head>';
foreach ($headers as $value) {
    echo $value;
}
echo '</head>';
echo '<body>';
echo $content;
echo '</body>';