spatie/laravel-markdown
Render Markdown in Laravel with a Blade x-markdown component or a configurable MarkdownRenderer. Converts content to HTML with heading IDs, links, and syntax-highlighted code blocks, using options from your config and container resolution.
By default, Shiki PHP is used to highlight 100+ languages, including PHP, JS, Blade, and many more.
In the code_highlighting.theme value op the markdown config file you can specify the default theme to be used. This value can be one of the themes that Shiki supports out of the box.
Shiki supports any VSCode themes.
You can use a custom theme using the absolute path to a theme in as the value for code_highlighting.theme.
Alternatively, you can pass a theme to highlightTheme
$html = app(Spatie\LaravelMarkdown\MarkdownRenderer::class)
->highlightTheme('github-dark')
->toHtml($markdown);
Code highlighting can be disabled globally, by setting the code_highlighting.enabled key in the markdown config file to false.
Alternatively, you call disableHighlighting().
$html = app(Spatie\LaravelMarkdown\MarkdownRenderer::class)
->disableHighlighting()
->toHtml($markdown);
How can I help you explore Laravel packages today?