2021-06-26 11:23:15 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Entities\Tools\Markdown;
|
2021-06-22 16:02:18 -04:00
|
|
|
|
|
|
|
use League\HTMLToMarkdown\Converter\ParagraphConverter;
|
|
|
|
use League\HTMLToMarkdown\ElementInterface;
|
|
|
|
|
|
|
|
class CustomParagraphConverter extends ParagraphConverter
|
|
|
|
{
|
|
|
|
public function convert(ElementInterface $element): string
|
|
|
|
{
|
2022-04-29 07:17:14 -04:00
|
|
|
$class = e($element->getAttribute('class'));
|
2021-06-22 16:02:18 -04:00
|
|
|
if (strpos($class, 'callout') !== false) {
|
|
|
|
return "<{$element->getTagName()} class=\"{$class}\">{$element->getValue()}</{$element->getTagName()}>\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::convert($element);
|
|
|
|
}
|
|
|
|
}
|