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 19, 2015
1 parent 3a7e195 commit 7919d21
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 6 deletions.
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@
"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": "dev-commonmark",
"php-di/php-di": "~5.0",
"psr/log": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/hason/FrontYAML"
}
]
}
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(),
];
1 change: 1 addition & 0 deletions tests/FunctionalTest/Fixture/basic/expected/doc/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
</head>
<body>
<p>Test</p>

</body>
</html>
1 change: 1 addition & 0 deletions tests/FunctionalTest/Fixture/basic/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<body>
<p>Hello, this is a test!</p>
<p>This is a <a href="doc/test.html">link</a>.</p>

</body>
</html>
1 change: 1 addition & 0 deletions tests/FunctionalTest/Fixture/headings/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ <h2 id="repeated-title">Repeated title</h2>
<h2 id="repeated-title-1">Repeated title</h2>
<h2 id="repeated-title-2">Repeated title</h2>
<h2 id="this_is_a_nameboolean-something--true---function">this_is_a_name(boolean $something = true) - Function</h2>

1 change: 1 addition & 0 deletions tests/FunctionalTest/Fixture/headings/expected/other.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<h2 id="repeated-title">Repeated title</h2>

1 change: 1 addition & 0 deletions tests/FunctionalTest/Fixture/images/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<p><img src="/logos/couscous.jpg" alt="Couscous logo" title="Couscous logo (.jpg)" /></p>
<p><img src="/logos/couscous.png" alt="Couscous logo" title="Couscous logo (.png)" /></p>
<p><img src="/logos/couscous.gif" alt="Couscous logo" title="Couscous logo (.gif)" /></p>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
</head>
<body>
<p>Hello, this is a test!</p>

</body>
</html>

0 comments on commit 7919d21

Please sign in to comment.