定制 ueberdosis/commonmark-hint-extension 二次开发

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

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

ueberdosis/commonmark-hint-extension

最新稳定版本:0.1.0

Composer 安装命令:

composer require ueberdosis/commonmark-hint-extension

包简介

A hint extension for league/commonmark

README 文档

README

We need your support to maintain this package. 💖 https://github.com/sponsors/ueberdosis

CommonMark Hint Extension

Tests Sponsor

A hint extension for league/commonmark that renders the following Markdown as HTML.

Example

Markdown

:::important Warning!
This is how the **Markdown** looks.
:::

HTML

<div class="hint important">
    <h2 class="hint-title">
        Warning!
    </h2>
    <p class="hint-content">
        This is how the <strong>Markdown</strong> looks.
    </p>
</div>

Installation

You can install the package via composer:

composer require ueberdosis/commonmark-hint-extension

Usage

<?php

use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Ueberdosis\CommonMark\HintExtension;

// Configure the Environment with all the CommonMark parsers/renderers
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());

// Add this extension
$environment->addExtension(new HintExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
$markdown = <<<MARKDOWN
:::important Warning!
This is how the **Markdown** looks.
:::
MARKDOWN;

echo $converter->convertToHtml($markdown);

Testing

composer test

Credits

License

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

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-26