8000 Update to CommonMark v2 · laravel/framework@ae2778c · GitHub
[go: up one dir, main page]

Skip to content

Commit ae2778c

Browse files
committed
Update to CommonMark v2
1 parent 4186af1 commit ae2778c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"doctrine/inflector": "^2.0",
2323
"dragonmantank/cron-expression": "^3.1",
2424
"egulias/email-validator": "^3.1",
25-
"league/commonmark": "^1.3|^2.0",
25+
"league/commonmark": "^2.0",
2626
"league/flysystem": "^2.0",
2727
"monolog/monolog": "^2.0",
2828
"nesbot/carbon": "^2.31",

src/Illuminate/Mail/Markdown.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
use Illuminate\Contracts\View\Factory as ViewFactory;
66
use Illuminate\Support\HtmlString;
77
use Illuminate\Support\Str;
8-
use League\CommonMark\CommonMarkConverter;
8+
use League\CommonMark\Environment\Environment;
9+
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
910
use League\CommonMark\Extension\Table\TableExtension;
11+
use League\CommonMark\MarkdownConverter;
1012
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
1113

1214
class Markdown
@@ -103,11 +105,14 @@ public function renderText($view, array $data = [])
103105
*/
104106
public static function parse($text)
105107
{
106-
$converter = new CommonMarkConverter([
108+
$environment = new Environment([
107109
'allow_unsafe_links' => false,
108110
]);
109111

110-
$converter->getEnvironment()->addExtension(new TableExtension());
112+
$environment->addExtension(new CommonMarkCoreExtension);
113+
$environment->addExtension(new TableExtension);
114+
115+
$converter = new MarkdownConverter($environment);
111116

112117
return new HtmlString((string) $converter->convertToHtml($text));
113118
}

src/Illuminate/Support/Str.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ public static function markdown($string, array $options = [])
403403
{
404404
$converter = new GithubFlavoredMarkdownConverter($options);
405405

406-
return (string) $converter->convertToHtml($string);
406+
return $converter->convertToHtml($string);
407407
}
408408

409409
/**

0 commit comments

Comments
 (0)
0