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.
##Configuring a theme
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);
##Disabling code highlighting
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);