定制 ryangjchandler/commonmark-blade-block 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ryangjchandler/commonmark-blade-block

最新稳定版本:v1.1.0

Composer 安装命令:

composer require ryangjchandler/commonmark-blade-block

包简介

Embed Laravel Blade code inside of your Markdown templates.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides an extension for league/commonmark that lets you embed Laravel Blade code inside of your Markdown content.

Installation

You can install the package via Composer:

composer require ryangjchandler/commonmark-blade-block

Usage

Start by registering the extension.

use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use RyanChandler\CommonmarkBladeBlock\BladeExtension;

$environment = new Environment();

$environment
    ->addExtension(new CommonMarkCoreExtension)
    ->addExtension(new BladeExtension);

$converter = new MarkdownConverter($environment);

Then start embedding Blade inside of your Markdown content with the @blade and @endblade tags.

# Hello, world!

@blade
<x-button>
    Click me!
</x-button>
@endblade

Using Laravel's Str or str() helpers

If you're using Str::markdown() or str()->markdown(), then you can register the extension through the extensions argument.

Str::markdown(
    <<<'MD'
    @blade
        <x-button></x-button>
    @endblade
    MD,
    extensions: [
        new BladeExtension(),
    ]
)

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 21
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-17