18ec9a8f2SSungbin Jeon<?php 28ec9a8f2SSungbin Jeon 38ec9a8f2SSungbin Jeonrequire_once __DIR__.'/src/bootstrap.php'; 48ec9a8f2SSungbin Jeon 58ec9a8f2SSungbin Jeonuse Dokuwiki\Plugin\Commonmark\Commonmark; 68ec9a8f2SSungbin Jeon 78ec9a8f2SSungbin Jeon//$environment = Environment::createCommonMarkEnvironment(); 88ec9a8f2SSungbin Jeon 98ec9a8f2SSungbin Jeon//$parser = new DocParser($environment); 108ec9a8f2SSungbin Jeon//$htmlRenderer = new HtmlRenderer($environment); 118ec9a8f2SSungbin Jeon 128ec9a8f2SSungbin Jeon$test1 = '# Hello World! 138ec9a8f2SSungbin Jeon> Blockquote Test! 148ec9a8f2SSungbin Jeon> test continues 158ec9a8f2SSungbin Jeon> 168ec9a8f2SSungbin Jeon> TEST! 178ec9a8f2SSungbin Jeon>> Indented test'; 188ec9a8f2SSungbin Jeon 198ec9a8f2SSungbin Jeon$test2 = '## List test 208ec9a8f2SSungbin Jeon### Unordered List 218ec9a8f2SSungbin Jeon- item 1 228ec9a8f2SSungbin Jeon- item 2 238ec9a8f2SSungbin Jeon - item 2.1 248ec9a8f2SSungbin Jeon- item 3 258ec9a8f2SSungbin Jeon 268ec9a8f2SSungbin Jeon### Ordered List 278ec9a8f2SSungbin Jeon1. item 1 288ec9a8f2SSungbin Jeon2. item 2 298ec9a8f2SSungbin Jeon 1. item 2.1 308ec9a8f2SSungbin Jeon3. item 3'; 318ec9a8f2SSungbin Jeon 328ec9a8f2SSungbin Jeon$test3 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a iaculis augue. Donec condimentum velit elit, et suscipit sem mattis ac. Duis consequat, velit a lobortis tempor, lorem elit accumsan sapien, sed consectetur mauris neque non erat. Aliquam erat volutpat. Nam posuere et sapien eu lobortis. Praesent fringilla ipsum non velit vulputate, ac pulvinar velit ultrices. Etiam neque massa, venenatis in placerat id, iaculis eu turpis. Sed interdum gravida odio quis porttitor. Nunc vestibulum facilisis ultrices. Ut ultricies, tortor a bibendum sodales, diam mi commodo nibh, non tincidunt nibh erat eget leo. Proin ac lorem eget libero semper consectetur. Phasellus bibendum neque erat, ac egestas nunc varius at. Integer eu ante tristique, semper erat eget, faucibus eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam imperdiet sollicitudin urna non maximus. Pellentesque tortor erat, pulvinar in mauris non, luctus ullamcorper nibh. 338ec9a8f2SSungbin Jeon 348ec9a8f2SSungbin JeonLorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a iaculis augue. Donec condimentum velit elit, et suscipit sem mattis ac. Duis consequat, velit a lobortis tempor, lorem elit accumsan sapien, sed consectetur mauris neque non erat. Aliquam erat volutpat. Nam posuere et sapien eu lobortis. Praesent fringilla ipsum non velit vulputate, ac pulvinar velit ultrices. 358ec9a8f2SSungbin JeonEtiam neque massa, venenatis in placerat id, iaculis eu turpis. Sed interdum gravida odio quis porttitor. Nunc vestibulum facilisis ultrices. Ut ultricies, tortor a bibendum sodales, diam mi commodo nibh, non tincidunt nibh erat eget leo. Proin ac lorem eget libero semper consectetur. Phasellus bibendum neque erat, ac egestas nunc varius at. Integer eu ante tristique, semper erat eget, faucibus eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam imperdiet sollicitudin urna non maximus. Pellentesque tortor erat, pulvinar in mauris non, luctus ullamcorper nibh.'; 368ec9a8f2SSungbin Jeon 378ec9a8f2SSungbin Jeon$test4 = '```ruby 388ec9a8f2SSungbin Jeondef foo(x) 398ec9a8f2SSungbin Jeon return 3 408ec9a8f2SSungbin Jeonend 418ec9a8f2SSungbin Jeon``` 428ec9a8f2SSungbin Jeon 438ec9a8f2SSungbin Jeon foo 448ec9a8f2SSungbin Jeonbar 458ec9a8f2SSungbin Jeon*** 468ec9a8f2SSungbin Jeon```html 478ec9a8f2SSungbin Jeon<html> 488ec9a8f2SSungbin Jeon<head> 498ec9a8f2SSungbin Jeondddd 508ec9a8f2SSungbin Jeon</head> 518ec9a8f2SSungbin Jeon</html> 528ec9a8f2SSungbin Jeon```'; 538ec9a8f2SSungbin Jeon 548ec9a8f2SSungbin Jeon$test5 = '`foo` 558ec9a8f2SSungbin Jeon 5678c882e7SSungbin Jeon*ITALIC* **BOLD** ***BOLDITALIC*** and ~~strikethrough~~ 578ec9a8f2SSungbin JeonHARD break [yahoo](yahoo.com) <p>hello</p> <a>hello</a> '; 588ec9a8f2SSungbin Jeon 59f46768a8SSungbin Jeon$test6 = 'hello, its footnote and [link] test [^1] [^2]. 60f46768a8SSungbin Jeon 61f46768a8SSungbin Jeon[link]: google.com 62f46768a8SSungbin Jeon[nolink]: facebook.com 63f46768a8SSungbin Jeon[^1]: footnote.com 64f46768a8SSungbin Jeon[^2]: secondfootnote.com 65f46768a8SSungbin Jeon[^3]: this is an anonymous footnote.'; 66f46768a8SSungbin Jeon 671adb3ebeSSungbin Jeon$test7 = ' 681adb3ebeSSungbin Jeon| Left columns | Right columns | 691adb3ebeSSungbin Jeon| ------------- |:-------------:| 701adb3ebeSSungbin Jeon| left foo | right foo | 711adb3ebeSSungbin Jeon| left bar | right bar | 721adb3ebeSSungbin Jeon| left baz | right baz | 731adb3ebeSSungbin Jeon'; 741adb3ebeSSungbin Jeon 75b0a36678SSungbin Jeon$test8 = ' list footnote test[^3]; 76286063f0SSungbin Jeon- **test**. 77286063f0SSungbin Jeon- test2[^2]. 78286063f0SSungbin Jeon - nested list test[^1]. 79286063f0SSungbin Jeon 80286063f0SSungbin Jeonoutside footnote test[^4]. 81286063f0SSungbin Jeon 82286063f0SSungbin Jeon[^1]: footnote test 1. 83286063f0SSungbin Jeon[^2]: footnote test 2. 84286063f0SSungbin Jeon[^3]: normal text test. 85286063f0SSungbin Jeon[^4]: normal text test 2. 86286063f0SSungbin Jeon'; 87286063f0SSungbin Jeon 88b0a36678SSungbin Jeon$test9 = ' 8994a075eeSSungbin JeonBefore the code 9094a075eeSSungbin Jeon 9194a075eeSSungbin Jeon``` 9294a075eeSSungbin Jeonfenced line 1 9394a075eeSSungbin Jeonfenced line 2 9494a075eeSSungbin Jeon``` 9594a075eeSSungbin Jeon 9694a075eeSSungbin Jeon indent line 1 9794a075eeSSungbin Jeon indent line 2 9894a075eeSSungbin Jeon 9994a075eeSSungbin JeonAfter the code'; 10094a075eeSSungbin Jeon 10181da5a38SSungbin Jeon$test10 = <<<MD 10281da5a38SSungbin Jeon--- 10381da5a38SSungbin Jeontags: 10481da5a38SSungbin Jeon - tag1 10581da5a38SSungbin Jeon - tag2 10681da5a38SSungbin Jeon--- 1078ec9a8f2SSungbin Jeon 10881da5a38SSungbin JeonBefore the code 10981da5a38SSungbin Jeon 11081da5a38SSungbin Jeon``` 11181da5a38SSungbin Jeonfenced line 1 11281da5a38SSungbin Jeonfenced line 2 11381da5a38SSungbin Jeon``` 11481da5a38SSungbin Jeon 11581da5a38SSungbin Jeon indent line 1 11681da5a38SSungbin Jeon indent line 2 11781da5a38SSungbin Jeon 11881da5a38SSungbin JeonAfter the code 11981da5a38SSungbin JeonMD; 12081da5a38SSungbin Jeon 121*4384789bSSungbin Jeon$test11_p = '--- 12281da5a38SSungbin Jeonlayout: post 12381da5a38SSungbin Jeontitle: I Love Markdown 12481da5a38SSungbin Jeontags: 12581da5a38SSungbin Jeon - test 12681da5a38SSungbin Jeon - example 12781da5a38SSungbin Jeon--- 12881da5a38SSungbin Jeon 12981da5a38SSungbin Jeon# Hello World! 130*4384789bSSungbin Jeon'; 131*4384789bSSungbin Jeon 132*4384789bSSungbin Jeon$test11 = <<<MD 133*4384789bSSungbin Jeon$test11_p 13481da5a38SSungbin JeonMD; 13581da5a38SSungbin Jeon 136*4384789bSSungbin Jeon$test = $test11_p; 13781da5a38SSungbin Jeonecho $test . "\n\n=========================\n\n"; 13881da5a38SSungbin Jeon$result = Commonmark::RendtoDW($test); 13981da5a38SSungbin Jeonecho $result; 14081da5a38SSungbin Jeon//$frontmatter = Commonmark::ExtractFrontmatter($test); 14181da5a38SSungbin Jeon//print_r($frontmatter); 1428ec9a8f2SSungbin Jeon?>