added usage example

master
Michael Ochmann 3 years ago
parent 1bca2ac15c
commit 08ea243729
  1. 19
      README.md

@ -112,6 +112,25 @@ or via reference to [a later defined url][massivedynamic], i we so desire.
[massivedynamic]: https://massivedynamic.eu
## Usage
Simply construct an new `parkdown\Parkdown` object and pass the Markdown source code to it's constructor. The parsed `DOMDocument` or it's `HTML` output can then be retrieved through the `::html()` and `::tree()` member functions.
**Example**
```php
use parkdown\Parkdown;
$source = "
This is a **bold** word in a paragraph.
";
$parser = new Parkdown($source);
$tree = $parser->tree();
print_r($tree);
echo $parser->html();
```
## Testing
Unit tests can be run via `composer`:

Loading…
Cancel
Save