From 197fb005debc39a7d624b50ee65deb51c35f77d1 Mon Sep 17 00:00:00 2001 From: Are0h Date: Tue, 14 Jun 2022 17:08:31 -0700 Subject: [PATCH] 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 --- brain/data/Contents.php | 11 ++++++++--- package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/brain/data/Contents.php b/brain/data/Contents.php index e37d949..7df74da 100644 --- a/brain/data/Contents.php +++ b/brain/data/Contents.php @@ -8,6 +8,7 @@ use League\CommonMark\Environment\Environment; use HtmlSanitizer\Extension\Basic\BasicExtension; use HtmlSanitizer\Extension\Listing\ListExtension; use HtmlSanitizer\Extension\Iframe\IframeExtension; +use League\CommonMark\Extension\Table\TableExtension; use League\CommonMark\Extension\Attributes\AttributesExtension; use League\CommonMark\Extension\FrontMatter\FrontMatterExtension; use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; @@ -18,8 +19,7 @@ use function _\orderBy; class Contents { - public $files = []; - + public $files = []; public $config = []; public function __construct($folder) @@ -54,6 +54,9 @@ class Contents //add attributes to elements in markdown $environment->addExtension(new AttributesExtension()); + //add table rendering + $environment->addExtension(new TableExtension()); + // Instantiate the converter engine and start converting some Markdown! $converter = new MarkdownConverter($environment); @@ -78,6 +81,8 @@ class Contents $builder->registerExtension(new BasicExtension()); $builder->registerExtension(new IframeExtension()); $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 $builder->registerExtension( @@ -88,7 +93,7 @@ class Contents ); $detergent = [ - 'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe'], + 'extensions' => ['basic', 'list', 'relative-a', 'relative-image', 'iframe', 'table'], 'tags' => [ 'div' => [ 'allowed_attributes' => ['class', 'title', 'id', 'style'], diff --git a/package.json b/package.json index 5a49979..be27ea0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fipamo-dash", - "version": "2.5.0", + "version": "2.5.1", "private": true, "apidoc": { "name": "Fipamo API",