tp_servicedesk/app/extensions/ParsedownTableExtension.php

28 lines
694 B
PHP

<?php
class ParsedownTableExtension extends Parsedown
{
protected function blockTable($Line, ?array $Block = null)
{
$Block = parent::blockTable($Line, $Block);
if(!isset($Block)){
return null;
}
// add classes to the table element
$Block['element']['attributes'] = [
'class' => 'table is-bordered',
];
// wrap the table in a bulma div
$Block['element'] = [
'name' => 'div',
'attributes' => [
'class' => 'table-container'
],
'handler' => 'element',
'text' => $Block['element'],
];
return $Block;
}
}