Skip to content

Commit 3be2397

Browse files
committed
Added examples for converting both ways.
1 parent 2be4701 commit 3be2397

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,29 @@ composer require limelight/bbcode-markdown-converter
1515
Simple as that.
1616

1717
## Example Use
18+
19+
Using the library is pretty easy. First up, converting from BBCode to Markdown.
1820
```php
1921
use \Limelight\Converter\Converter;
2022

2123
require __DIR__ . '/vendor/autoload.php';
2224

2325
$bbCode = file_get_contents(__DIR__ . '/data/test_post.bb'); // Pull the test post.
2426

25-
$conv = new Converter(); // You can set the text in the constructor too.
26-
$conv->setText($bbCode);
27+
$conv = new Converter($bbCode)
2728
$conv->bbToMarkdown();
2829
echo $conv->getText();
30+
```
31+
32+
Easy, right? And the other way around.
33+
```php
34+
use \Limelight\Converter\Converter;
35+
36+
require __DIR__ . '/vendor/autoload.php';
37+
38+
$mdText = file_get_contents(__DIR__ . '/data/test_md.md'); // Pull the test post.
39+
40+
$conv = new Converter($mdText)
41+
$conv->markdownToBB();
42+
echo $conv->getText();
2943
```

0 commit comments

Comments
 (0)