sevenecks / markdown-terminal
将 markdown 转换为 PHP 的终端输出
0.0.1
2018-09-12 19:06 UTC
Requires
- php: >=7.0
- cebe/markdown: ~1.2.0
- sevenecks/ansi: ^1.0
- sevenecks/string-utils: ^0.0.15
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-13 09:59:39 UTC
README
此项目是对 Markdown 的扩展,增加了将 markdown 转换为终端输出的能力,而不是 HTML。
这是一个我编写的支持基于终端的 markdown 笔记本的 PHP 小型爱好项目。转换效果尽可能好,但并不完整,也可能存在错误。我将根据需求进行改进,但使用时请自行承担风险,并且不要期望它现在看起来非常美观 :)
您可以使用 setConfig 函数来设置各种配置选项,以实现输出的着色。
安装
通过 Composer
composer require sevenecks/markdown-terminal
示例用法
<?php // you must run this from the /example directory // require '../vendor/autoload.php'; $markdown = <<<EOT # Headline 1 ## Headline 2 ### Headline 3 #### Headline 4 ##### Headline 5 ###### Headline 6 \``` protected function renderStrong($block) { return \$this->colorize->bold(\$this->renderAbsy($block[1])); } \``` * One * Two * Five 1. test 2. test2 1. Four 2. Five 3. Six * Test * Test 2 * One * Two * Four 1. test 2. test * test > this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test > test > this is a test > another test >> test quote in quote, which doesn't currently work. this is a **strong** text this is some _emphasis_. [I'm an inline-style link](https://www.github.com/sevenecks) [I'm a relative reference to a repository file](../blob/master/LICENSE) Inline-style: [Seven Ecks Git Hub Alt Text](http://www.github.com/sevenecks "Sevenecks GitHub Title") [another example]: https://github.com/sevenecks "another example" ~~Strike Through~~ EOT; $parser = new SevenEcks\Markdown\MarkdownTerminal; echo $parser->parse($markdown);
已知问题
- 引号内的引号不起作用
- 在三个反引号(`)之后指定语言不起作用,并且会以奇怪的方式格式化。
- 列表项偶尔会出现异常
- 在所有终端仿真器上都不会显示删除线
变更日志
有关更多信息,请参阅 变更日志。
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。