Skip to content

Commit

Permalink
Replaced Parsedown with CommonMark
Browse files Browse the repository at this point in the history
  • Loading branch information
hason committed Nov 16, 2015
1 parent 3a7e195 commit 8b771f0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
"symfony/process": "~2.6",
"symfony/yaml": "~2.6",
"twig/twig": "~1.10",
"erusev/parsedown": "~1.5",
"erusev/parsedown-extra": "~0.7",
"league/commonmark": "~0.12",
"webuni/commonmark-table-extension": "~0.4",
"webuni/commonmark-attributes-extension": "~0.3",
"phine/phar": "~1.0",
"mnapoli/front-yaml": "~1.5",
"mnapoli/front-yaml": "^1.5.1",
"php-di/php-di": "~5.0",
"psr/log": "~1.0"
},
Expand Down
26 changes: 24 additions & 2 deletions src/Module/Markdown/config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
<?php

use Interop\Container\ContainerInterface;

return [

'Mni\FrontYAML\Parser' => DI\object()
->constructorParameter('markdownParser', DI\get('Mni\FrontYAML\Markdown\MarkdownParser')),

'Mni\FrontYAML\Markdown\MarkdownParser' => DI\object('Mni\FrontYAML\Bridge\Parsedown\ParsedownParser')
->constructor(DI\get('ParsedownExtra')),
'Mni\FrontYAML\Markdown\MarkdownParser' => DI\object('Mni\FrontYAML\Bridge\CommonMark\CommonMarkParser')
->constructor(DI\get('League\CommonMark\Converter')),

'League\CommonMark\Converter' => DI\object()
->constructor(DI\get('League\CommonMark\DocParser'), DI\get('League\CommonMark\HtmlRenderer')),

'League\CommonMark\DocParser' => DI\object()
->constructor(DI\get('League\CommonMark\Environment')),

'League\CommonMark\HtmlRenderer' => DI\object()
->constructor(DI\get('League\CommonMark\Environment')),

'League\CommonMark\Environment' => function (ContainerInterface $c) {
$env = \League\CommonMark\Environment::createCommonMarkEnvironment();
$env->addExtension($c->get('Webuni\CommonMark\TableExtension\TableExtension'));
$env->addExtension($c->get('Webuni\CommonMark\AttributesExtension\AttributesExtension'));

return $env;
},

'Webuni\CommonMark\TableExtension\TableExtension' => DI\object(),

'Webuni\CommonMark\AttributesExtension\AttributesExtension' => DI\object(),
];

0 comments on commit 8b771f0

Please sign in to comment.