|
18 | 18 |
|
19 | 19 | //specific functions for the frontend |
20 | 20 |
|
21 | | -use League\CommonMark\Environment\Environment; |
22 | | -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; |
23 | | -use League\CommonMark\Extension\GithubFlavoredMarkdownExtension; |
24 | | -use League\CommonMark\MarkdownConverter; |
25 | | - |
26 | 21 | function spacer($width=1, $height=1) { |
27 | 22 | //creates a placeholder image (transparent gif) |
28 | 23 | return '<span style="display:inline-block;width:'.intval($width).'px;height:'.intval($height).'px" class="'.$GLOBALS['template_default']['classes']['spaceholder'].'"></span>'; |
@@ -4567,10 +4562,10 @@ function get_attr_data_gallery($group='', $prefix=' ', $suffix='') { |
4567 | 4562 | function init_markdown() { |
4568 | 4563 |
|
4569 | 4564 | if(!isset($GLOBALS['phpwcms']['commonmark_class'])) { |
4570 | | - $environment = new Environment(); |
4571 | | - $environment->addExtension(new CommonMarkCoreExtension()); |
4572 | | - $environment->addExtension(new GithubFlavoredMarkdownExtension()); |
4573 | | - $GLOBALS['phpwcms']['commonmark_class'] = new MarkdownConverter($environment); |
| 4565 | + $environment = new \League\CommonMark\Environment\Environment(); |
| 4566 | + $environment->addExtension(new \League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension()); |
| 4567 | + $environment->addExtension(new \League\CommonMark\Extension\GithubFlavoredMarkdownExtension()); |
| 4568 | + $GLOBALS['phpwcms']['commonmark_class'] = new \League\CommonMark\MarkdownConverter($environment); |
4574 | 4569 | } |
4575 | 4570 |
|
4576 | 4571 | } |
@@ -4599,3 +4594,16 @@ function parse_markdown(string $text) { |
4599 | 4594 | init_markdown(); |
4600 | 4595 | return $GLOBALS['phpwcms']['commonmark_class']->convert($text); |
4601 | 4596 | } |
| 4597 | + |
| 4598 | +/** |
| 4599 | + * Parse content with Textile |
| 4600 | + * |
| 4601 | + * @param string $text |
| 4602 | + */ |
| 4603 | +function parse_textile(string $text) { |
| 4604 | + if ($text === '') { |
| 4605 | + return ''; |
| 4606 | + } |
| 4607 | + init_textile(); |
| 4608 | + return $GLOBALS['phpwcms']['textile_class']->textileThis($text); |
| 4609 | +} |
0 commit comments