cipemotion / commonmark
一个联盟 CommonMark 扩展。
v3.0.0
2021-07-26 12:17 UTC
Requires
- php: ^7.4 || ^8.0
- league/commonmark: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
README
内联转换器
内联语法用于在文本设置中快速标记,例如注释,在这些设置中不需要全功能的 wysiwig 编辑器,但您希望向用户提供一些使用 markdown 语法进行格式化的选项。
支持以下内联语法
_emphasis_
转换为<em>emphasis</em>
*bold*
转换为<strong>bold</strong>
~deleted~
转换为<del>deleted</del>
`code`
转换为<code>code</code>
[link](https://url)
转换为<a href="https://url">link</a>

转换为!<a href="https://url">link</a>
(图像被禁用)- 换行转换为段落
- 去除 HTML (可以禁用以允许 HTML)
使用方法
// When `$allowHtml` is `true` HTML is _not_ removed in the output, default is false $converter = \CipeMotion\CommonMark\Markdown::getInlineConverter($allowHtml); $html = $converter->convertToHtml('This is _awesome_!')->getContent(); // or $html = (string)$converter->convertToHtml('This is _awesome_!');