Skip to content

Commit

Permalink
Merge pull request #79 from bjuppa/update-commonmark
Browse files Browse the repository at this point in the history
Add support for both CommonMark 1.x and 2.x
  • Loading branch information
bjuppa authored Sep 8, 2021
2 parents f6a102d + 2020bea commit 74d97ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"illuminate/http": "5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8",
"spatie/laravel-sluggable": "^2.1",
"bjuppa/metatagbag": "^1.0",
"league/commonmark": "^1.3"
"league/commonmark": "^1.3 || ^2.0"
},
"require-dev": {
"orchestra/testbench": "~3.6.7 || ~3.7.8 || ~3.8.6 || ^4.8 || ^5.2 || ^6.0",
Expand Down
6 changes: 2 additions & 4 deletions src/Support/CommonMarkString.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ public static function create(string $markdown): MarkdownString
*/
protected static function parse($markdown): string
{
$environment = Environment::createCommonMarkEnvironment();

$converter = new CommonMarkConverter([
'allow_unsafe_links' => false,
], $environment);
]);

return $converter->convertToHtml($markdown);
return (string) $converter->convertToHtml($markdown);
}

/**
Expand Down

0 comments on commit 74d97ae

Please sign in to comment.