定制 skizu/gitdown 二次开发

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

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

skizu/gitdown

最新稳定版本:V1.0

Composer 安装命令:

composer require skizu/gitdown

包简介

Markdown parser for PHP based on the CommonMark spec with integration into git

README 文档

README

skizu/gitdown combines git repos with a Markdown parser for PHP which supports the full CommonMark spec

Goals

  • Fully support the CommonMark spec (100% compliance)
  • Provide an extensible git library integration component
  • To be able to load, compare and parse versions of MarkDown files within a git repo

Installation

This project can be installed via Composer:

$ composer require skizu/gitdown

Basic Usage

The GitDownConverter class provides a simple wrapper for converting CommonMark files within a git repo to HTML:

use Skizu\GitDown\GitDownConverter;

$gitDownConverter = new GitDownConverter('/path/to/repo');
echo $gitDownConverter->convertToHtml('path/to/file.md');

// <h1>Hello World!</h1>

The GitDownDiff class provides a simple wrapper for performing diffs on CommonMark files within a git repo:

use Skizu\GitDown\GitDownDiff
 
$gitDownDiff = new GitDownDiff('/path/to/repo');
$diff = $gitDownDiff->getDiff('master@{2 days ago}..master');
 
foreach($diff as $file => $data) {
   echo '<h1>'.$file.'<h1>';
   foreach($data['lines'] as $line) {
      echo $line;
   }
}
 
// <h1>README.md</h1>
// -* Fully support the CommonMark spec (100% compliance)\n
// +* Fully support the [CommonMark spec] (100% compliance)\n 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-08-07