Introduction | laravel-markdown | Spatie

 SPATIE

  Laravel Markdown
===================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-markdown](https://spatie.be/docs/laravel-markdown/v1)  Introduction

 Version   v1

 Other versions for crawler [v1](https://spatie.be/docs/laravel-markdown/v1)

- [ Introduction ](https://spatie.be/docs/laravel-markdown/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-markdown/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-markdown/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-markdown/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-markdown/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-markdown/v1/changelog)
- [ Resources and alternatives ](https://spatie.be/docs/laravel-markdown/v1/resources-and-alternatives)
- [ About us ](https://spatie.be/docs/laravel-markdown/v1/about-us)

Usage in Blade
--------------

- [ General usage ](https://spatie.be/docs/laravel-markdown/v1/usage-in-blade/general-usage)
- [ Configuring code highlighting ](https://spatie.be/docs/laravel-markdown/v1/usage-in-blade/configuring-code-highlighting)
- [ Rendering anchors ](https://spatie.be/docs/laravel-markdown/v1/usage-in-blade/rendering-anchors)
- [ Passing options to Commonmark ](https://spatie.be/docs/laravel-markdown/v1/usage-in-blade/passing-options-to-commonmark)
- [ ](https://spatie.be/docs/laravel-markdown/v1/usage-in-blade/adding-custom-attributes)

Rendering markdown
------------------

- [ General usage ](https://spatie.be/docs/laravel-markdown/v1/rendering-markdown/general-usage)
- [ Configuring code highlighting ](https://spatie.be/docs/laravel-markdown/v1/rendering-markdown/configuring-code-highlighting)
- [ Rendering anchors ](https://spatie.be/docs/laravel-markdown/v1/rendering-markdown/rendering-anchors)
- [ Passing options to Commonmark ](https://spatie.be/docs/laravel-markdown/v1/rendering-markdown/passing-options-to-commonmark)

Advanced usage
--------------

- [ Highlighting lines ](https://spatie.be/docs/laravel-markdown/v1/advanced-usage/highlighting-lines)
- [ Caching results ](https://spatie.be/docs/laravel-markdown/v1/advanced-usage/caching-results)
- [ Customizing the rendering process ](https://spatie.be/docs/laravel-markdown/v1/advanced-usage/customizing-the-rendering-process)

 Laravel Markdown
==================

 Markdown renderer and Blade component for Laravel

 [    Repository ](https://github.com/spatie/laravel-markdown)

    3,484,134

    405

Introduction
------------

###  On this page

1. [ We have badges! ](#content-we-have-badges)

This package contains:

- a Blade component that can render markdown
- a highly configurable class that you can use to render markdown

Let's start with an example of the provided `x-markdown` Blade component. This chunk of markdown...

```

# My title

This is a [link to our website](https://spatie.be)

```php
echo 'Hello world';
```

```

... will be converted to this chunk of HTML:

```

    My title
    This is a link to our website
    echo &#39;Hello world&#39;;

```

You can also programmatically render HTML.

```
// by resolving the class out of the container all the options
// in the config file will be used.

app(Spatie\LaravelMarkdown\MarkdownRenderer::class)->toHtml($markdown);
```

Out of the box, the `x-markdown` component or `MarkdownRenderer` can:

- highlight code blocks correctly (via [Shiki PHP](https://github.com/spatie/shiki-php)) for 100+ languages, including PHP, JS, Blade, [and many more](https://github.com/shikijs/shiki/blob/main/docs/languages.md).
- add anchor links to headings
- cache results to increase performance

We have badges!
---------------------------------------------------------------------------------------------------

 [![Latest Version](https://img.shields.io/github/release/spatie/laravel-markdown.svg?style=flat-square)](https://github.com/spatie/laravel-markdown/releases) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/spatie/laravel-markdown/blob/main/LICENSE.md) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-markdown.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-markdown)
