I am creating documentation for my blade based components in a laravel project and would like to display syntax highlighted blade code snippets as part of the documentation a la something like this:
I have installed graham-campbell/markdown
package and I try use it inside a .blade.php file as follows:
(Do not mind the escape character)
However, the output I get is as follows:
You can wrap the Blade in a @verbatim
directive and use Highlight JS with a style you like
<p>You can use the laravel code template like this</p>
@markdown
```php
@verbatim
@include('components.inputs.text', [
'name' => 'input_name',
'label' => 'testing',
])
@endverbatim
```
@endmarkdown
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/styles/a11y-dark.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
Hope this helps