Added Markdown table conversion and version update

Added markdown table conversion to the html process so we get sexy
tables. Also updated the version number to prep for the latest beta
realease. Ha, took a minute but we're back on track
pull/84/head
Are0h 2 years ago
parent 00d41a3664
commit 197fb005de

@ -8,6 +8,7 @@ use League\CommonMark\Environment\Environment;
use HtmlSanitizer\Extension\Basic\BasicExtension; use HtmlSanitizer\Extension\Basic\BasicExtension;
use HtmlSanitizer\Extension\Listing\ListExtension; use HtmlSanitizer\Extension\Listing\ListExtension;
use HtmlSanitizer\Extension\Iframe\IframeExtension; use HtmlSanitizer\Extension\Iframe\IframeExtension;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\Extension\Attributes\AttributesExtension; use League\CommonMark\Extension\Attributes\AttributesExtension;
use League\CommonMark\Extension\FrontMatter\FrontMatterExtension; use League\CommonMark\Extension\FrontMatter\FrontMatterExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
@ -18,8 +19,7 @@ use function _\orderBy;
class Contents class Contents
{ {
public $files = []; public $files = [];
public $config = []; public $config = [];
public function __construct($folder) public function __construct($folder)
@ -54,6 +54,9 @@ class Contents
//add attributes to elements in markdown //add attributes to elements in markdown
$environment->addExtension(new AttributesExtension()); $environment->addExtension(new AttributesExtension());
//add table rendering
$environment->addExtension(new TableExtension());
// Instantiate the converter engine and start converting some Markdown! // Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment); $converter = new MarkdownConverter($environment);
@ -78,6 +81,8 @@ class Contents
$builder->registerExtension(new BasicExtension()); $builder->registerExtension(new BasicExtension());
$builder->registerExtension(new IframeExtension()); $builder->registerExtension(new IframeExtension());
$builder->registerExtension(new ListExtension()); $builder->registerExtension(new ListExtension());
//just add it straight because classname is already in use
$builder->registerExtension(new \HtmlSanitizer\Extension\Table\TableExtension());
//relative-a and relative-image //relative-a and relative-image
$builder->registerExtension( $builder->registerExtension(
@ -88,7 +93,7 @@ class Contents
); );
$detergent = [ $detergent = [
'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe'], 'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe', 'table'],
'tags' => [ 'tags' => [
'div' => [ 'div' => [
'allowed_attributes' => ['class', 'title', 'id', 'style'], 'allowed_attributes' => ['class', 'title', 'id', 'style'],

@ -1,6 +1,6 @@
{ {
"name": "fipamo-dash", "name": "fipamo-dash",
"version": "2.5.0", "version": "2.5.1",
"private": true, "private": true,
"apidoc": { "apidoc": {
"name": "Fipamo API", "name": "Fipamo API",

Loading…
Cancel
Save