Skip to main content
Back to packages
1,345 GitHub stars

GrahamCampbell/Laravel-Markdown

View on GitHub

Description

Laravel Markdown is a CommonMark wrapper for Laravel

Here you can see an example of just how simple this package is to use.

use GrahamCampbell\Markdown\Facades\Markdown;
 
Markdown::convert('foo')->getContent(); // <p>foo</p>

If you prefer to use dependency injection over facades like me, then you can easily inject the class like so:

use League\CommonMark\ConverterInterface;
 
class Foo
{
private ConverterInterface $converter;
 
public function __construct(ConverterInterface $converter)
{
$this->converter = $converter;
}
 
public function bar(): string
{
return $this->converter->convert('foo')->getContent();
}
}
 
app(Foo::class)->bar();

Recent Courses on Laravel Daily

Roles and Permissions in Laravel 13

14 lessons
57 min

Laravel 13 Eloquent: Expert Level

41 lessons
1 h 34 min

Queues in Laravel 13

18 lessons
1 h 12 min read

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.