写了个Laravel的Markdown解析器

在用laravel写网站的过程中,需要markdown解析器。于是就高速造了个轮子。

laravelmd - A Markdown Parser for Laravel

Based on PHP-Markdown

Installation

To get the latest version of laravelmd, simply require the project using Composer:

1
composer require imtms/laravelmd

Instead, you may of course manually update your require block and run composer update if you so choose:

1
2
3
4
5
{
"require": {
"imtms/laravelmd": "^1.0"
}
}

Configuration

Once laravelmd is installed, you need to register the service provider.

Open up config/app.php and add the following to the providers key.

1
imtms\laravelmd\laravelmdProvider::class,

You can register the Markdown facade in the aliases key of your config/app.php file if you like.

1
'laravelmd' => imtms\laravelmd\Facades\laravelmd::class,

Usage

1
\laravelmd::convert('foo'); // <p>foo</p>

License

The MIT License (MIT).

本文作者: TMs
本文链接: https://blog.tms.im/2016/06/28/laravel-markdown.html
版权声明: 本作品采用 CC BY-NC-SA 3.0 CN 进行许可。转载请注明出处!
知识共享许可协议