Compare commits
1 commit
master
...
swap-markd
Author | SHA1 | Date | |
---|---|---|---|
Oliver Davies | 4e893efd97 |
|
@ -1,3 +1,6 @@
|
||||||
sculpin_content_types:
|
sculpin_content_types:
|
||||||
posts:
|
posts:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
twig.markdown.parser.class: 'App\Markdown\CommonMarkMarkdownParser'
|
||||||
|
|
22
app/src/Markdown/CommonMarkMarkdownParser.php
Normal file
22
app/src/Markdown/CommonMarkMarkdownParser.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Markdown;
|
||||||
|
|
||||||
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\Twig\SculpinTwigMarkdownParserInterface;
|
||||||
|
|
||||||
|
class CommonMarkMarkdownParser implements SculpinTwigMarkdownParserInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function transform($text)
|
||||||
|
{
|
||||||
|
$converter = new CommonMarkConverter([
|
||||||
|
'html_input' => 'strip',
|
||||||
|
'allow_unsafe_links' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $converter->convertToHtml($text);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,8 +10,9 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"sculpin/sculpin": "^3.0",
|
"league/commonmark": "^1.1",
|
||||||
"opdavies/sculpin-twig-markdown-bundle": "dev-markdown"
|
"opdavies/sculpin-twig-markdown-bundle": "dev-markdown",
|
||||||
|
"sculpin/sculpin": "^3.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "composer run-script generate",
|
"dev": "composer run-script generate",
|
||||||
|
@ -26,5 +27,10 @@
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.1-dev"
|
"dev-master": "2.1-dev"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/src"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
612
composer.lock
generated
612
composer.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue