Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

skizu/gitdown

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:

useSkizu\GitDown\GitDownConverter;
$gitDownConverter = newGitDownConverter('/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:

useSkizu\GitDown\GitDownDiff$gitDownDiff = newGitDownDiff('/path/to/repo');
$diff = $gitDownDiff->getDiff('master@{2 days ago}..master');
foreach($diffas$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 

About

Combines git repos with a Markdown parser

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages