Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"doctrine/inflector": "^2.0",
"dragonmantank/cron-expression": "^3.1",
"egulias/email-validator": "^3.1",
"league/commonmark": "^1.3|^2.0",
"league/commonmark": "^2.0",
"league/flysystem": "^2.0",
"monolog/monolog": "^2.0",
"nesbot/carbon": "^2.31",
Expand Down
11 changes: 8 additions & 3 deletions src/Illuminate/Mail/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\MarkdownConverter;
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;

class Markdown
Expand Down Expand Up @@ -103,11 +105,14 @@ public function renderText($view, array $data = [])
*/
public static function parse($text)
{
$converter = new CommonMarkConverter([
$environment = new Environment([
'allow_unsafe_links' => false,
]);

$converter->getEnvironment()->addExtension(new TableExtension());
$environment->addExtension(new CommonMarkCoreExtension);
$environment->addExtension(new TableExtension);

$converter = new MarkdownConverter($environment);

return new HtmlString((string) $converter->convertToHtml($text));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"illuminate/contracts": "^9.0",
"illuminate/macroable": "^9.0",
"illuminate/support": "^9.0",
"league/commonmark": "^1.3|^2.0",
"league/commonmark": "^2.0",
"psr/log": "^1.0",
"swiftmailer/swiftmailer": "^6.2.7",
"tijsverkoyen/css-to-inline-styles": "^2.2.2"
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"suggest": {
"illuminate/filesystem": "Required to use the composer class (^9.0).",
"league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^1.3|^2.0).",
"league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.0).",
"ramsey/uuid": "Required to use Str::uuid() (^4.0).",
"symfony/process": "Required to use the composer class (^5.3).",
"symfony/var-dumper": "Required to use the dd function (^5.3).",
Expand Down