Skip to content

Advanced Markdown


Since HydePHP makes heavy use of Markdown, there are some extra features and helpers created just for Hyde to make using Markdown even easier and more powerful!

Using Blade in Markdown

A special feature in Hyde, is that you can use Laravel Blade in Markdown files!

To use Blade in your Markdown files, simply use the Blade shortcode directive, followed by your desired Blade string.

Standard syntax

1[Blade]: {{ "Hello World!" }} // Will render: 'Hello World!'

Blade includes

Only single-line shortcode directives are supported. If you need to use multi-line Blade code, use an @include directive to render a more complex Blade template. You can pass data to includes by specifying an array to the second argument.

1[Blade]: @include("hello-world")
2[Blade]: @include("hello", ["name" => "World"])

Enabling Blade-supported Markdown

The feature is disabled by default since it allows arbitrary PHP to run, which could be a security risk, depending on your setup. However, if your Markdown is trusted, and you know it's safe, you can enable it in the config/markdown.php file.

Filepath: config/markdown.php
1'enable_blade' => true,


All shortcodes must be the first word on a new line, and only single-line shortcodes are supported.

Coloured Blockquotes

The HydePHP Markdown converter also supports some extra directives and features. One of them being four different coloured blockquotes. Simply append the desired colour after the initial > character.

1‎> Normal Blockquote
2‎>info Info Blockquote
3‎>warning Warning Blockquote
4‎>danger Danger Blockquote
5‎>success Success Blockquote

Normal Blockquote

Info Blockquote

Warning Blockquote

Danger Blockquote

Success Blockquote


You can easily customize these styles too by adding and editing the following in your resources/app.css file, and then recompiling your site styles. The code examples here use the Tailwind @apply directives, but you could also use border-color: something; just as well.

Filepath: resources/app.css
1/* Markdown Features */
3.prose {
4 @apply border-blue-500;
7.prose blockquote.success {
8 @apply border-green-500;
11.prose blockquote.warning {
12 @apply border-amber-500;
15.prose blockquote.danger {
16 @apply border-red-600;

Markdown usage

The coloured blockquotes also support inline Markdown, just like normal blockquotes.

1‎>info Formatting is **supported**!


Note that these currently do not support multi-line blockquotes.

Code block filepaths

When browsing these documentation pages you may have noticed a label in the top right corner of code blocks specifying the file path. These are also created by using a custom Hyde feature that turns code comments into automatic code blocks.


Simply add a code comment with the path in the first line of a fenced code block like so:

Filepath: _docs/
2// Filepath: hello-world.php
4echo 'Hello World!';

Which becomes:

Filepath: hello-world.php
1echo 'Hello World!';

Alternative syntax

The syntax is rather forgiving, by design, and supports using both // and # for comments. The colon is also optional, and the 'filepath' string is case-insensitive. So the following is also perfectly valid:

2// filepath hello.js
3console.log('Hello World!');

If you have a newline after the filepath, like in the first example, it will be removed so your code stays readable.

Advanced usage

If you have enabled HTML in Markdown by setting the allow_html option to true in your config/markdown.php file, anything within the path label will be rendered as HTML. This means you can add links, or even images to the label.

Filepath: View file on Github
2‎// Filepath: <a href="">View file on Github</a>


The filepaths are hidden on mobile devices using CSS to prevent them from overlapping with the code block.


Full configuration reference

All Markdown-related configuration options are in the config/markdown.php file. You can find the full reference on the Customization page.

Raw HTML Tags

To convert Markdown, HydePHP uses the GitHub Flavored Markdown extension, which strips out potentially unsafe HTML. If you want to allow all arbitrary HTML tags, and understand the risks involved, you can enable all HTML tags by setting the allow_html option to true in your config/markdown.php file.

Filepath: config/markdown.php
1'allow_html' => true,

This will add and configure the DisallowedRawHtml CommonMark extension so that no HTML tags are stripped out.