承接 xp-forge/markdown 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

xp-forge/markdown

最新稳定版本:v8.1.2

Composer 安装命令:

composer require xp-forge/markdown

包简介

Markdown

关键字:

README 文档

README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

The Markdown syntax implemented for the XP Framework.

Example

To transform markdown to HTML, all that is necessary is the following:

use net\daringfireball\markdown\Markdown;

$engine= new Markdown();
$transformed= $engine->transform(
  'This is [Markdown](http://daringfireball.net/projects/markdown/) for **XP**'
);

The implementation is based on a parse tree. To work with the tree, you can use the parse() method, which returns a net.daringfireball.markdown.ParseTree instance.

use net\daringfireball\markdown\{Markdown, ToHtml};
use io\streams\TextReader;
use io\File;

$engine= new Markdown();

$tree= $engine->parse($markdown);
$tree= $engine->parse(new TextReader(new File('file.md')));

// ...work with tree...

$transformed= $tree->emit(new ToHtml());

You can control the URLs used in the href and src attributes of links and images, respectively, by using URL rewriting API:

use net\daringfireball\markdown\{ToHtml, URLs, Rewriting};

$emitter= new ToHtml(new URLs(Rewriting::absolute()
  ->links('/deref?url=%s')
  ->images('/proxy?url=&s')
  ->excluding(['localhost'])
));

$transformed= $engine->transform($markdown, [], $emitter);
$transformed= $engine->parse($markdown)->emit($emitter);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-01-10