From cd8b696822dcf148afc171ec3902d8cd62ce6bc4 Mon Sep 17 00:00:00 2001 From: Tarek Djebali Date: Mon, 16 Nov 2020 13:51:24 +0100 Subject: [PATCH 1/3] Fixes #18: Table not generate --- src/Commands/BuildCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 25a602c..04bfca9 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -11,6 +11,7 @@ use Illuminate\Filesystem\Filesystem; use Symfony\Component\Console\Command\Command; use League\CommonMark\Block\Element\FencedCode; +use League\CommonMark\Extension\Table\TableExtension; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Spatie\CommonMarkHighlighter\FencedCodeRenderer; @@ -108,6 +109,7 @@ protected function buildHtml(string $path) $this->output->writeln('==> Parsing Markdown ...'); $environment = Environment::createCommonMarkEnvironment(); + $environment->addExtension(new TableExtension()); $environment->addBlockRenderer(FencedCode::class, new FencedCodeRenderer([ 'html', 'php', 'js', 'bash', 'json' From 0ef49864ffbd9a0096c82137dfb83d690d1d8aef Mon Sep 17 00:00:00 2001 From: Tarek Djebali Date: Tue, 17 Nov 2020 18:00:07 +0100 Subject: [PATCH 2/3] Styling theme-light tables --- stubs/assets/theme-light.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/stubs/assets/theme-light.html b/stubs/assets/theme-light.html index fd6f126..262314e 100644 --- a/stubs/assets/theme-light.html +++ b/stubs/assets/theme-light.html @@ -160,6 +160,26 @@ blockquote.warning strong { color: #c0262b; } + + table { + border-collapse: collapse; + width: 100%; + } + + td, th { + border: 1px solid #ddd; + padding: 8px; + } + + tr:nth-child(even){background-color: #f2f2f2;} + + th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #525252; + color: white; + } From a18ddf32473bcf712ec94ca5f6de9ae5eaa82aa9 Mon Sep 17 00:00:00 2001 From: Tarek Djebali Date: Tue, 17 Nov 2020 18:01:11 +0100 Subject: [PATCH 3/3] Styling theme-dark tables --- stubs/assets/theme-dark.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/stubs/assets/theme-dark.html b/stubs/assets/theme-dark.html index faf979d..bd577df 100644 --- a/stubs/assets/theme-dark.html +++ b/stubs/assets/theme-dark.html @@ -160,6 +160,29 @@ blockquote.warning strong { color: #dd787d; } + + table { + border-collapse: collapse; + width: 100%; + } + + td, th { + border: 1px solid #ddd; + padding: 8px; + } + + tr:nth-child(even){ + background-color: #113e63; + color: #011627; + } + + th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #001321; + color: white; + }