forked from SolidCharity/discourse_to_flarum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
36 lines (26 loc) · 864 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include __DIR__ . '/vendor/autoload.php';
use s9e\TextFormatter\Bundles\Forum as TextFormatter;
// init TextFormatter
global $parser;
$configurator = new s9e\TextFormatter\Configurator;
$configurator->plugins->load('Litedown');
$configurator->plugins->load('BBCodes');
$configurator->BBCodes->addFromRepository('CODE');
// see https://github.com/flarum/core/blob/master/src/Formatter/Formatter.php
$configurator->rootRules->enableAutoLineBreaks();
$configurator->Escaper;
$configurator->Autoemail;
$configurator->Autolink;
$configurator->tags->onDuplicate('replace');
extract($configurator->finalize());
$text = "test [mein link](http://www.google.com) test";
$text = "test http://www.google.com test";
$text = $parser->parse($text);
echo $text;
echo "\n";
$text = "test [code]test[/code]";
$text = $parser->parse($text);
echo $text;
echo "\n";
?>