mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-17 08:44:01 +08: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);
|
|
}
|
|
}
|