bfrohs / markdown
dev-master
2013-10-31 17:05 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2022-02-01 12:27:52 UTC
README
重要:这是一个实验,可能随时被更改、重置或丢弃。在使用此代码之前请谨慎。
需要跟踪的一些事项
开发者友好的 PHP Markdown 解析器。
使用
// If using composer, you're all set // If not, add the following path to your PSR-0 autoloader: /path/to/markdown/psr-0 // Or include the class manually // require_once('/path/to/markdown/src/app.php'); // Make `Markdown` an alias for `bfrohs\markdown\Markdown` use bfrohs\markdown\Markdown; // Create a new Markdown object with the scope of 'p' $text = "Some string using *markdown*."; $markdown = new Markdown($text); // Convert provided markdown to HTML $html = $markdown->toHTML(); echo $html; // <p>Some string using <em>markdown</em>.</p>
与Dingus的区别
-
元素间的空白将被忽略
-
空白将被压缩成一个空格
-
空元素将输出不带尾部斜杠(例如,
<br>而不是<br />) -
目前不支持
- html
<div> - 实体
" - 自动链接
<http://example.com/> - 代码块
<?php - 引用链接
[foo][]
- html