承接 marcandreappel/bladedown 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marcandreappel/bladedown

Composer 安装命令:

composer require marcandreappel/bladedown

包简介

Blade directives for Markdown parsing in Laravel 7+.

README 文档

README

A small and lightweight Laravel 7 package for parsing markdown inside of Blade templates.

Installation

Install it with Composer:

composer require marcandreappel/bladedown

Run the php artisan vendor:publish command to publish the configuration file.

Usage

Blade directive

The markdown parser can be used in Blade templates by using the @markdown directive:

<article>
    <h1>{{ $post->title }}</h1>

    <section class="content">
        @markdown($post->body)
    </section>
</article>

A block-style syntax is also available:

@markdown
# Hello world

This *text* will be **parsed** to [HTML](http://laravel.com).
@endmarkdown

Facade

$markdown = "# Hello";

$html = Markdown::parse($markdown); // <h1>Hello</h1>

Helpers

$html = markdown('# Hello'); // <h1>Hello</h1>
$html = markdown_capture(function () {
    echo "# Hello";
    echo "\n\n";
    echo "So **cool**!";
});

// <h1>Hello</h1>
// <p>So <b>cool</b>!</p>

You can also resolve the parser from the service container:

$parser = app('Appel\Bladedown\Parser');
$html = $parser->parse('# Hello'); // <h1>Hello</h1>

Drivers

Bladedown allows you to add custom markdown drivers. In order to use a custom markdown driver, you need to create a class which implements the Appel\Bladedown\Drivers\MarkdownDriver interface. The interface contains two methods: text and line. text is used to convert a block of markdown to HTML, while line is used to convert a single line.

Bladedown ships with a ParsedownDriver using the Parsedown library by @erusev.

Important notes

This package is incompatible with andreasindal/laravel-markdown, because it is build upon it.

Credits

License

See the LICENSE file.

统计信息

  • 总下载量: 58
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固