{"id":19324929,"url":"https://github.com/spatie/laravel-markdown","last_synced_at":"2025-05-14T11:12:14.684Z","repository":{"id":39920654,"uuid":"385010125","full_name":"spatie/laravel-markdown","owner":"spatie","description":"A highly configurable markdown renderer and Blade component for Laravel","archived":false,"fork":false,"pushed_at":"2025-03-03T08:40:37.000Z","size":208,"stargazers_count":369,"open_issues_count":0,"forks_count":31,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T02:57:29.699Z","etag":null,"topics":["code","highlight","laravel","markdown","php"],"latest_commit_sha":null,"homepage":"https://freek.dev/2024-how-to-render-markdown-with-perfectly-highlighted-code-snippets","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/support-us.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"spatie"}},"created_at":"2021-07-11T17:20:30.000Z","updated_at":"2025-04-11T01:28:11.000Z","dependencies_parsed_at":"2024-12-22T08:01:44.436Z","dependency_job_id":"13b923fc-114c-4ef4-903e-9b389d5758e6","html_url":"https://github.com/spatie/laravel-markdown","commit_stats":{"total_commits":178,"total_committers":26,"mean_commits":6.846153846153846,"dds":0.4550561797752809,"last_synced_commit":"5cbe18b2df9a56b38e3d56fd953e2adf19106d7d"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-markdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813786,"owners_count":21165632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","highlight","laravel","markdown","php"],"created_at":"2024-11-10T02:07:33.558Z","updated_at":"2025-04-14T02:57:35.220Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie"],"categories":[],"sub_categories":[],"readme":"# A highly configurable markdown renderer and Blade component for Laravel\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-markdown.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-markdown)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/spatie/laravel-markdown/run-tests.yml?label=Tests\u0026branch=main)](https://github.com/spatie/laravel-markdown/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/spatie/laravel-markdown/php-cs-fixer.yml?label=Code%20Style\u0026branch=main)](https://github.com/spatie/laravel-markdown/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-markdown.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-markdown)\n\nThis package contains:\n\n- a Blade component that can render markdown\n- a highly configurable class that you can use to render markdown\n\nLet's start with an example of the provided `x-markdown` Blade component. This chunk of markdown...\n\n````blade\n\u003cx-markdown\u003e\n# My title\n\nThis is a [link to our website](https://spatie.be)\n\n```php\necho 'Hello world';\n```\n\u003c/x-markdown\u003e\n````\n\n... will be converted by to component to this chunk of HTML:\n\n```html\n\u003cdiv\u003e\n    \u003ch1 id=\"my-title\"\u003eMy title\u003c/h1\u003e\n    \u003cp\u003eThis is a \u003ca href=\"https://spatie.be\"\u003elink to our website\u003c/a\u003e\u003c/p\u003e\n    \u003cpre class=\"shiki\" style=\"background-color: #fff\"\u003e\u003ccode\u003e\u003cspan class=\"line\"\u003e\u003cspan\n        style=\"color: #005CC5\"\u003eecho\u003c/span\u003e\u003cspan style=\"color: #24292E\"\u003e \u003c/span\u003e\u003cspan style=\"color: #032F62\"\u003e\u0026#39;Hello world\u0026#39;\u003c/span\u003e\u003cspan\n        style=\"color: #24292E\"\u003e;\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"line\"\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003c/div\u003e\n```\n\nYou can also programmatically render HTML.\n\n```php\n// by resolving the class out of the container all the options\n// in the config file will be used.\n\napp(Spatie\\LaravelMarkdown\\MarkdownRenderer::class)-\u003etoHtml($markdown);\n```\n\nOut of the box, the `x-markdown` component and `MarkdownRenderer` can:\n\n- 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).\n- add anchor links to headings\n- cache results to increase performance\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-markdown.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-markdown)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nYou can find installation instructions and detailed instructions on how to use this package at [the dedicated documentation site](https://docs.spatie.be/laravel-markdown/v1/introduction/).\n\n## Related packages\n\nIf you only need the league/commonmark extension to highlight code, head over to [spatie/commonmark-shiki-highlighter](https://github.com/spatie/commonmark-shiki-highlighter).\n\nIn case you don't need the markdown support, but want to highlight code directly, take a look at [spatie/shiki-php](https://github.com/spatie/shiki-php).\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\n## Alternatives\n\nIf you don't want to install and handle Shiki yourself, take a look at [Torchlight](https://torchlight.dev), which can highlight your code with minimal setup.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-markdown/lists"}