mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
21 lines
556 B
PHP
21 lines
556 B
PHP
|
<?php
|
||
|
|
||
|
namespace BookStack\Entities\Tools\Markdown;
|
||
|
|
||
|
use League\HTMLToMarkdown\Converter\DivConverter;
|
||
|
use League\HTMLToMarkdown\ElementInterface;
|
||
|
|
||
|
class CustomDivConverter extends DivConverter
|
||
|
{
|
||
|
public function convert(ElementInterface $element): string
|
||
|
{
|
||
|
// Clean up draw.io diagrams
|
||
|
$drawIoDiagram = $element->getAttribute('drawio-diagram');
|
||
|
if ($drawIoDiagram) {
|
||
|
return "<div drawio-diagram=\"{$drawIoDiagram}\">{$element->getValue()}</div>\n\n";
|
||
|
}
|
||
|
|
||
|
return parent::convert($element);
|
||
|
}
|
||
|
}
|