diff --git a/app/Support/Markdown.php b/app/Support/Markdown.php index 852677dd5..8c32932d7 100644 --- a/app/Support/Markdown.php +++ b/app/Support/Markdown.php @@ -52,7 +52,7 @@ public static function parse(string $text): static $static->convert(); $static->removeH1Tags(); - $static->convertSpecialBlockQuotes(); + $static->convertSpecialBlockquotes(); return $static; } @@ -77,7 +77,7 @@ protected function removeH1Tags(): static return $this; } - protected function convertSpecialBlockQuotes(): static + protected function convertSpecialBlockquotes(): static { $this->content = preg_replace( pattern: [ @@ -111,6 +111,33 @@ public function absoluteImageUrls(string $baseUrl): static return $this; } + public function convertVideoToHtml(): static + { + $this->content = preg_replace_callback( + pattern: '/(?content, $url) > 1) { + return ''; + } + + return << + + + HTML; + }, + subject: $this->content + ); + + return $this; + } + public function __toString(): string { return str($this->content)->sanitizeHtml(); diff --git a/resources/views/plugins/view-plugin.blade.php b/resources/views/plugins/view-plugin.blade.php index fd94e2d54..75c28b2f5 100644 --- a/resources/views/plugins/view-plugin.blade.php +++ b/resources/views/plugins/view-plugin.blade.php @@ -344,11 +344,13 @@ class="block w-32 rounded-lg border border-gray-300 bg-gray-50 p-2 text-sm text- class="prose selection:bg-stone-500/30 prose-a:break-words prose-blockquote:not-italic prose-code:break-words prose-code:rounded prose-code:bg-merino prose-code:px-1.5 prose-code:py-0.5 prose-code:font-normal prose-code:before:hidden prose-code:after:hidden [&_p]:before:hidden [&_p]:after:hidden" > {!! - \App\Support\Markdown::parse($docs)->absoluteImageUrls( - baseUrl: str($plugin->getDocUrl(request()->query('v'))) - ->lower() - ->before('readme.md'), - ) + \App\Support\Markdown::parse($docs) + ->convertVideoToHtml() + ->absoluteImageUrls( + baseUrl: str($plugin->getDocUrl(request()->query('v'))) + ->lower() + ->before('readme.md'), + ) !!}