jsw / commonmark-figure-extension

League/commonmark 扩展,用于HTML图示和标题。

1.2.0 2024-01-10 12:07 UTC

This package is auto-updated.

Last update: 2024-09-10 14:53:54 UTC


README

League/CommonMark 扩展,用于HTML图示和标题,灵感来源于 Markdig

安装

$ composer require jsw/commonmark-figure-extension

使用

  • 使用 ^ 将你想要成为图示的句子的顶部和底部括起来,就像代码块一样
  • 底部括号内的连续文本将成为图示标题
  • 即使上下 ^ 的数量不同,也会正常处理
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
            ->addExtension(new FigureExtension());

$converter = new MarkdownConverter($environment);

$markdown =<<<EOL
^^^
![example-image](https://example.com/image.jpg)
^^^ This is caption for image
EOL;

// <figure><p><img src="https://example.com/image.jpg" alt="example-image" /></p>
// <figcaption>This is caption for image</figcaption></figure>
echo $converter->convert($markdown);

贡献

  1. 分支它 (https://github.com/JanStanleyWatt/commonmark-figure-extension)
  2. 创建你的功能分支 (git checkout -b my-new-feature)
  3. 提交你的更改 (git commit -am 'Add some feature')
  4. 将你的本地更改与主分支合并(如果需要的话)
  5. 使用 composer test 命令运行测试套件并确认通过
  6. 将更改推送到分支 (git push origin my-new-feature)
  7. 创建新的Pull Request

许可证

Apache-v2