|
| 1 | +--- |
| 2 | +--- |
| 3 | + |
| 4 | +# Markdown with Hyde |
| 5 | + |
| 6 | +Hyde makes heavy use of Markdown. While this page won't teach you how to use Markdown, |
| 7 | +it will hopefully shed some light about how Hyde uses it, and how you can extend it using Front Matter. |
| 8 | + |
| 9 | +## Front Matter |
| 10 | + |
| 11 | +All Markdown content files support Front Matter. Blog posts for example make heavy use of it. |
| 12 | + |
| 13 | +The specific usage and schemas used for pages are documented in their respective documentation, |
| 14 | +however, here is a primer on the fundamentals. |
| 15 | + |
| 16 | +- Front matter is stored in a block of YAML that starts and ends with a `---` line. |
| 17 | +- The front matter should be the very first thing in the Markdown file. |
| 18 | +- Each key-pair value should be on its own line. |
| 19 | + |
| 20 | +**Example:** |
| 21 | +```markdown |
| 22 | +--- |
| 23 | +title: "My New Post" |
| 24 | +author: |
| 25 | + name: "John Doe" |
| 26 | + website: https://mrhyde.example.com |
| 27 | +--- |
| 28 | + |
| 29 | +## Markdown comes here |
| 30 | + |
| 31 | +Lorem ipsum dolor sit amet, etc. |
| 32 | +``` |
| 33 | + |
| 34 | +## CommonMark environment |
| 35 | + |
| 36 | +Hyde uses [League CommonMark](https://commonmark.thephpleague.com/) for converting Markdown into HTML. |
| 37 | + |
| 38 | +### Customizing the environment |
| 39 | + |
| 40 | +Hyde ships with the Github Flavored Markdown extension, and |
| 41 | +the Torchlight extension is enabled automatically when needed. |
| 42 | + |
| 43 | +You can add extra CommonMark extensions, or change the default ones, in the `config/markdown.php` file. |
| 44 | + |
| 45 | +```php |
| 46 | +'extensions' => [ |
| 47 | + \League\CommonMark\Extension\GithubFlavoredMarkdownExtension::class, |
| 48 | + \League\CommonMark\Extension\Attributes\AttributesExtension::class, |
| 49 | + \League\CommonMark\Extension\DisallowedRawHtml\DisallowedRawHtmlExtension::class, |
| 50 | +], |
| 51 | +``` |
| 52 | + |
| 53 | +In the same file you can also change the config to be passed to the CommonMark environment. |
| 54 | + |
| 55 | +```php |
| 56 | +'config' => [ |
| 57 | + 'disallowed_raw_html' => [ |
| 58 | + 'disallowed_tags' => [], |
| 59 | + ], |
| 60 | +], |
| 61 | +``` |
0 commit comments