定制 sevenecks/markdown-terminal 二次开发

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

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

sevenecks/markdown-terminal

最新稳定版本:0.0.1

Composer 安装命令:

composer require sevenecks/markdown-terminal

包简介

convert markdown to terminal output in php

README 文档

README

This project is an extension of Markdown that adds the ability to convert markdown to terminal output instead of HTML.

This is just a little hobby project I wrote to support a terminal based markdown note taker in PHP. The conversion does it's best, but it's by no means complete or bug free. I'll improve it as my needs demand but use this at your own risk, and don't expect it to look super pretty at this point :)

You can use the setConfig function to set various config options for colorizing the output.

Installation

Via Composer

composer require sevenecks/markdown-terminal

Example Usage

<?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);

Example Output

Known Issues

  1. quoted quotes do not work
  2. specifying a language after three backticks (`) does not work and will format weirdly.
  3. Every now and then wonkiness happens with list items
  4. strikethrough won't work on all terminal emulators

Change Log

Please see Change Log for more information.

License

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

统计信息

  • 总下载量: 361
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固