fluxbb/commonmark
Composer 安装命令:
composer require fluxbb/commonmark
包简介
Object-oriented and extensible PHP 5.4+ CommonMark spec-compliant Markdown parser
README 文档
README
An object oriented, fully extensible CommonMark parser for PHP 5.4 and above.
- Forked from Ciconia by Kazuyuki Hayashi
- Tested to comply with the full CommonMark spec test suite
Requirements
- PHP 5.4+
- Composer
Installation
Add the library to your Composer dependencies:
composer require fluxbb/commonmark
Next, use Composer to install the library and its dependencies:
composer install
Usage
Parsing
use FluxBB\CommonMark\Parser; $parser = new Parser(); $html = $parser->render('Markdown is **awesome**'); // <p>Markdown is <em>awesome</em></p>
Rendering
The parser renders XHTML by default.
Command Line Interface
Usage
Basic usage: (Outputs result to STDOUT)
bin/markdown /path/to/file.md
The following command saves results to a file:
bin/markdown /path/to/file.md > /path/to/file.html
Or using pipe (does not work on Windows):
echo "Markdown is **awesome**" | bin/markdown
Command Line Options
--compress (-c) Remove whitespace between HTML tags
--lint (-l) Syntax check only (lint)
Using PHAR version
You can also use a single phar file
markdown.phar /path/to/file.md
If you prefer access this command globally, download markdown.phar and move it into your PATH.
mv markdown.phar /usr/local/bin/markdown
Testing
Install or update dev dependencies.
php composer.phar update --dev
and run phpunit
License
The MIT License
Contributing
Feel free to fork this repository and send pull requests. Take a look at who has contributed so far.
Author
A big thanks to Kazuyuki Hayashi (@kzykhys), who originally created this library.
统计信息
- 总下载量: 570
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-17