Wire MediaEmbedExtension into Document::renderMarkdown
The extension registers a DocumentParsedEvent listener that walks the AST, finds Image nodes whose URLs match media patterns (via MediaUrlResolver), and replaces them with MediaEmbedNode instances containing the appropriate <video>/<audio>/<iframe> markup. A custom MediaEmbedNode + MediaEmbedNodeRenderer pair bypasses the html_input filter (which would strip raw HTML when set to 'strip'), allowing programmatically generated embed HTML to pass through safely while user-authored raw HTML remains stripped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,7 @@ public static function renderMarkdown(string $markdown): string
|
||||
]);
|
||||
|
||||
$converter->getEnvironment()->addExtension(new GithubFlavoredMarkdownExtension());
|
||||
$converter->getEnvironment()->addExtension(new \App\Markdown\MediaEmbedExtension());
|
||||
|
||||
return $converter->convert($markdown)->getContent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user