michelf/php-markdown
michelf/php-markdown is a fast, standards-based Markdown parser for PHP (Markdown and Markdown Extra). Convert Markdown text to HTML with optional extended syntax, designed for easy embedding in apps and frameworks, with stable output and minimal setup.
composer require michelf/php-markdown.Michelf\Markdown class for standard Markdown or Michelf\MarkdownExtra for extended syntax (tables, fenced code blocks, footnotes, etc.).use Michelf\Markdown;
$html = (new Markdown())->transform($markdownText);
.md files (e.g., for documentation routes or static pages).{!! $html !!} (remember to escape output when needed—e.g., avoid unsanitized user input).MarkdownRenderer) for reuse across controllers, jobs, or queues.Markdown or MarkdownExtra to add custom reference definitions, syntax hooks, or override transformations (see transform() override points in docs).@markdown directive to enable @markdown…@endmarkdown blocks in Blade views.transform() returns raw HTML—never use {{ $html }} in Blade (it double-escapes). Use {!! $html !!} only for trusted sources; sanitize user input with a library like HTML Purifier first.html_markup). Consider setting html_markup = false in MarkdownExtra for stricter control.new \Michelf\MarkdownExtra(). Standard Markdown ignores them.Markdown::CODE_INCREMENT or use Xdebug to inspect internal state. Check for trailing whitespace in reference links (common source of errors).MarkdownExtra; standard Markdown won’t support them.league/commonmark instead.How can I help you explore Laravel packages today?