Fix #61 Use the new up to date syntax to load and use CommonMark

Update the dependencies
This commit is contained in:
Timothée Jaussoin 2022-12-20 15:13:00 +01:00
parent 6e56559050
commit 6b90b29900
2 changed files with 12 additions and 15 deletions

View file

@ -23,10 +23,9 @@ use App\Account;
use App\DigestNonce;
use App\ExternalAccount;
use Illuminate\Support\Facades\Schema;
use League\CommonMark\Environment;
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension;
use League\CommonMark\Extension\TableOfContents\TableOfContentsExtension;
use League\CommonMark\MarkdownConverter;
function generateNonce(): string
{
@ -63,10 +62,7 @@ function percent($value, $max)
function markdownDocumentationView($view): string
{
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new HeadingPermalinkExtension);
$environment->addExtension(new TableOfContentsExtension);
$environment->mergeConfig([
$converter = new CommonMarkConverter([
'heading_permalink' => [
'html_class' => 'permalink',
'insert' => 'after',
@ -79,10 +75,11 @@ function markdownDocumentationView($view): string
],
]);
$converter = new MarkdownConverter($environment);
$converter->getEnvironment()->addExtension(new HeadingPermalinkExtension);
$converter->getEnvironment()->addExtension(new TableOfContentsExtension);
return (string) $converter->convertToHtml(
view($view, [
return (string) $converter->convert(
(string)view($view, [
'app_name' => config('app.name')
])->render()
);

12
flexiapi/composer.lock generated
View file

@ -7982,16 +7982,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.21",
"version": "9.2.22",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0"
"reference": "e4bf60d2220b4baaa0572986b5d69870226b06df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3f893e19712bb0c8bc86665d1562e9fd509c4ef0",
"reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e4bf60d2220b4baaa0572986b5d69870226b06df",
"reference": "e4bf60d2220b4baaa0572986b5d69870226b06df",
"shasum": ""
},
"require": {
@ -8047,7 +8047,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.21"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.22"
},
"funding": [
{
@ -8055,7 +8055,7 @@
"type": "github"
}
],
"time": "2022-12-14T13:26:54+00:00"
"time": "2022-12-18T16:40:55+00:00"
},
{
"name": "phpunit/php-file-iterator",