Add Markdown tables support
This commit is contained in:
parent
602309b167
commit
9497be3817
@ -15,9 +15,10 @@
|
|||||||
"php": ">=5.4",
|
"php": ">=5.4",
|
||||||
"league/plates": "~3.1",
|
"league/plates": "~3.1",
|
||||||
"guzzlehttp/guzzle": "~5.3",
|
"guzzlehttp/guzzle": "~5.3",
|
||||||
"league/commonmark": "0.8.*",
|
"league/commonmark": "^0.11",
|
||||||
"symfony/console": "~2.7",
|
"symfony/console": "~2.7",
|
||||||
"symfony/finder": "~2.7"
|
"symfony/finder": "~2.7",
|
||||||
|
"webuni/commonmark-table-extension": "0.4.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
75
composer.lock
generated
75
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "7cb7ddabbb3aaa33e7504afc4c7150b9",
|
"hash": "90ed477bfae85bfdc868d7685b04531d",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/guzzle",
|
"name": "guzzlehttp/guzzle",
|
||||||
@ -167,16 +167,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/commonmark",
|
"name": "league/commonmark",
|
||||||
"version": "0.8.0",
|
"version": "0.11.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/commonmark.git",
|
"url": "https://github.com/thephpleague/commonmark.git",
|
||||||
"reference": "91696c88df298f75fdd2075e4bb19c6dbd7338ca"
|
"reference": "d22d6a6a4b049faccc2f8e491cce6076eeb165c7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/91696c88df298f75fdd2075e4bb19c6dbd7338ca",
|
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d22d6a6a4b049faccc2f8e491cce6076eeb165c7",
|
||||||
"reference": "91696c88df298f75fdd2075e4bb19c6dbd7338ca",
|
"reference": "d22d6a6a4b049faccc2f8e491cce6076eeb165c7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -188,16 +188,21 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"erusev/parsedown": "~1.0",
|
"erusev/parsedown": "~1.0",
|
||||||
"jgm/commonmark": "0.19",
|
"jgm/commonmark": "0.22",
|
||||||
|
"jgm/smartpunct": "0.22",
|
||||||
"michelf/php-markdown": "~1.4",
|
"michelf/php-markdown": "~1.4",
|
||||||
|
"mikehaertl/php-shellcommand": "~1.1.0",
|
||||||
"phpunit/phpunit": "~4.3",
|
"phpunit/phpunit": "~4.3",
|
||||||
"phpunit/phpunit-mock-objects": "2.3.0",
|
"phpunit/phpunit-mock-objects": "2.3.0",
|
||||||
"symfony/finder": "~2.3"
|
"symfony/finder": "~2.3"
|
||||||
},
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/commonmark"
|
||||||
|
],
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "0.8-dev"
|
"dev-master": "0.12-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -224,7 +229,7 @@
|
|||||||
"markdown",
|
"markdown",
|
||||||
"parser"
|
"parser"
|
||||||
],
|
],
|
||||||
"time": "2015-04-29 18:01:46"
|
"time": "2015-09-25 12:40:32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "league/plates",
|
"name": "league/plates",
|
||||||
@ -427,6 +432,60 @@
|
|||||||
"description": "Symfony Finder Component",
|
"description": "Symfony Finder Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-09-19 19:59:23"
|
"time": "2015-09-19 19:59:23"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "webuni/commonmark-table-extension",
|
||||||
|
"version": "0.4.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/webuni/commonmark-table-extension.git",
|
||||||
|
"reference": "569bdc491abe1dc25f2346e946b19695c4045e18"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/webuni/commonmark-table-extension/zipball/569bdc491abe1dc25f2346e946b19695c4045e18",
|
||||||
|
"reference": "569bdc491abe1dc25f2346e946b19695c4045e18",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"league/commonmark": "^0.11",
|
||||||
|
"php": ">=5.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fabpot/php-cs-fixer": "^1.9",
|
||||||
|
"phpunit/phpunit": "^4.3",
|
||||||
|
"symfony/var-dumper": "^2.7"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.4-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Webuni\\CommonMark\\TableExtension\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Martin Hasoň",
|
||||||
|
"email": "martin.hason@gmail.com",
|
||||||
|
"role": "Lead Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "The table extension for CommonMark PHP implementation",
|
||||||
|
"homepage": "https://github.com/webuni/commonmark-table-extension",
|
||||||
|
"keywords": [
|
||||||
|
"commonmark",
|
||||||
|
"markdown",
|
||||||
|
"table"
|
||||||
|
],
|
||||||
|
"time": "2015-09-22 21:06:47"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
|
@ -89,17 +89,10 @@ Or perhaps someone a little less eloquent:
|
|||||||
Table for two
|
Table for two
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
<table>
|
ID | Name | Rank
|
||||||
<tr>
|
---|:------:|------:
|
||||||
<th>ID</th><th>Name</th><th>Rank</th>
|
1 | Tom Preston-Werner | Awesome
|
||||||
</tr>
|
2 | Albert Einstein | Nearly as awesome
|
||||||
<tr>
|
|
||||||
<td>1</td><td>Tom Preston-Werner</td><td>Awesome</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>2</td><td>Albert Einstein</td><td>Nearly as awesome</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
Crazy linking action
|
Crazy linking action
|
||||||
--------------------
|
--------------------
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use League\CommonMark\DocParser;
|
use League\CommonMark\DocParser;
|
||||||
use League\CommonMark\Environment;
|
use League\CommonMark\Environment;
|
||||||
use League\CommonMark\HtmlRenderer;
|
use League\CommonMark\HtmlRenderer;
|
||||||
|
use Webuni\CommonMark\TableExtension\TableExtension;
|
||||||
|
|
||||||
class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
|
class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
|
||||||
{
|
{
|
||||||
@ -15,6 +16,7 @@ class CommonMarkConverter extends \League\CommonMark\CommonMarkConverter
|
|||||||
{
|
{
|
||||||
$environment = Environment::createCommonMarkEnvironment();
|
$environment = Environment::createCommonMarkEnvironment();
|
||||||
$environment->mergeConfig($config);
|
$environment->mergeConfig($config);
|
||||||
|
$environment->addExtension(new TableExtension());
|
||||||
|
|
||||||
$this->extendEnvironment($environment);
|
$this->extendEnvironment($environment);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php namespace Todaymade\Daux\ContentTypes\Markdown;
|
<?php namespace Todaymade\Daux\ContentTypes\Markdown;
|
||||||
|
|
||||||
use League\CommonMark\HtmlElement;
|
use League\CommonMark\HtmlElement;
|
||||||
use League\CommonMark\HtmlRendererInterface;
|
use League\CommonMark\ElementRendererInterface;
|
||||||
use League\CommonMark\Inline\Element\AbstractInline;
|
use League\CommonMark\Inline\Element\AbstractInline;
|
||||||
use League\CommonMark\Inline\Element\Link;
|
use League\CommonMark\Inline\Element\Link;
|
||||||
use Todaymade\Daux\Config;
|
use Todaymade\Daux\Config;
|
||||||
@ -43,11 +43,11 @@ class LinkRenderer extends \League\CommonMark\Inline\Renderer\LinkRenderer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Link $inline
|
* @param Link $inline
|
||||||
* @param HtmlRendererInterface $htmlRenderer
|
* @param ElementRendererInterface $htmlRenderer
|
||||||
*
|
*
|
||||||
* @return HtmlElement
|
* @return HtmlElement
|
||||||
*/
|
*/
|
||||||
public function render(AbstractInline $inline, HtmlRendererInterface $htmlRenderer)
|
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
|
||||||
{
|
{
|
||||||
// This can't be in the method type as
|
// This can't be in the method type as
|
||||||
// the method is an abstract and should
|
// the method is an abstract and should
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php namespace Todaymade\Daux\Format\Confluence\ContentTypes\Markdown;
|
<?php namespace Todaymade\Daux\Format\Confluence\ContentTypes\Markdown;
|
||||||
|
|
||||||
use League\CommonMark\HtmlElement;
|
use League\CommonMark\HtmlElement;
|
||||||
use League\CommonMark\HtmlRendererInterface;
|
use League\CommonMark\ElementRendererInterface;
|
||||||
use League\CommonMark\Inline\Element\AbstractInline;
|
use League\CommonMark\Inline\Element\AbstractInline;
|
||||||
use League\CommonMark\Inline\Element\Link;
|
use League\CommonMark\Inline\Element\Link;
|
||||||
|
|
||||||
@ -9,11 +9,11 @@ class LinkRenderer extends \Todaymade\Daux\ContentTypes\Markdown\LinkRenderer
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Link $inline
|
* @param Link $inline
|
||||||
* @param HtmlRendererInterface $htmlRenderer
|
* @param ElementRendererInterface $htmlRenderer
|
||||||
*
|
*
|
||||||
* @return HtmlElement
|
* @return HtmlElement
|
||||||
*/
|
*/
|
||||||
public function render(AbstractInline $inline, HtmlRendererInterface $htmlRenderer)
|
public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
|
||||||
{
|
{
|
||||||
// This can't be in the method type as
|
// This can't be in the method type as
|
||||||
// the method is an abstract and should
|
// the method is an abstract and should
|
||||||
|
Loading…
x
Reference in New Issue
Block a user