diff --git a/src/Markdown.php b/src/Markdown.php index 6800fcc..e38d3ab 100644 --- a/src/Markdown.php +++ b/src/Markdown.php @@ -33,9 +33,12 @@ class Markdown extends Parsedown /** * Media type. * - * @var string $mediaType + * @var array $mediaType */ - protected string $mediaType = 'audio/ogg; codecs=opus'; + protected array $mediaType = [ + 'audio' => 'audio/ogg; codecs=opus', + 'video' => 'video/mp4' + ]; /** * Hostname link. @@ -187,16 +190,17 @@ public function tableOfContents(bool $enable = true): self /** * Set media type * - * @param string $type + * @param string $context The media context type (e.g, `audio`, `video`). + * @param string $type The attribute of media type (e.g, `audio/ogg; codecs=opus`). * * @return self */ - public function setMediaType(string $type): self + public function setMediaType(string $context, string $type): self { - $this->mediaType = $type; + $this->mediaType[$context] = $type; return $this; - } + } /** * Get table of contents. @@ -263,7 +267,7 @@ protected function blockMedia(array $Line, ?array $Block = null): array $html = '
'; $html .= ($isVideo ? '' : ''); @@ -400,5 +404,4 @@ public static function toKebabCase(string $string): string return mb_strtolower($string); } - }