在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):GrahamCampbell/Laravel-Markdown开源软件地址(OpenSource Url):https://github.com/GrahamCampbell/Laravel-Markdown开源编程语言(OpenSource Language):PHP 99.3%开源软件介绍(OpenSource Introduction):Laravel MarkdownLaravel Markdown was created by, and is maintained by Graham Campbell, and is a CommonMark wrapper for Laravel. It ships with integration with Laravel's view system too. Feel free to check out the change log, releases, security policy, license, code of conduct, and contribution guidelines. InstallationThis version requires PHP 7.4-8.1 and supports Laravel 8-9.
To get the latest version, simply require the project using Composer: $ composer require graham-campbell/markdown:^14.0 Once installed, if you are not using automatic package discovery, then you need to register the You can also optionally alias our facade: 'Markdown' => GrahamCampbell\Markdown\Facades\Markdown::class, ConfigurationLaravel Markdown supports optional configuration. To get started, you'll need to publish all vendor assets: $ php artisan vendor:publish This will create a There are several config options: Enable View IntegrationThis option ( CommonMark ExtensionsThis option ( Renderer ConfigurationThis option ( CommonMark ConfigurationThis option ( HTML InputThis option ( Allow Unsafe LinksThis option ( Maximum Nesting LevelThis option ( Slug NormalizerThis option ( UsageFacades\MarkdownThis facade will dynamically pass static method calls to the MarkdownServiceProviderThis class contains no public methods of interest. This class should be added to the providers array in Real ExamplesHere 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 Illuminate\Support\Facades\App;
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::make(Foo::class)->bar(); And don't forget, that's just the basics. We also support extension through listening for the resolving event from the container, and we ship with integration with Laravel's view system. You can use both the For example, the following are all methods of rendering markdown:
@markdown('# Foo')
@markdown
# Bar
@endmarkdown
Further InformationThere are other classes in this package that are not documented here (such as the engine and compiler classes). This is because they are not intended for public use and are used internally by this package. ExtensionsAs hinted in the configuration docs, CommonMark can be modified using extensions. There are some very good examples in the customization section of the CommonMark docs for how to create custom parsers and renders in the customization section: https://commonmark.thephpleague.com/. SecurityIf you discover a security vulnerability within this package, please send an email to [email protected]. All security vulnerabilities will be promptly addressed. You may view our full security policy here. LicenseLaravel Markdown is licensed under The MIT License (MIT). For EnterpriseAvailable as part of the Tidelift Subscription The maintainers of |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论