appertly / axe-markdown
Appertly XHP Extras Markdown: Markdown to XHP
Installs: 99
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:Hack
Requires
- hhvm: ~3.12
- facebook/xhp-lib: ~2.2
- league/commonmark: ^0.13
Requires (Dev)
- hackpack/hackunit: ~0.6
This package is not auto-updated.
Last update: 2024-12-21 20:57:39 UTC
README
A ppertly X HP E xtras Markdown: Markdown to XHP in Hack/HHVM.
Installation
You can install this library using Composer:
$ composer require appertly/axe-markdown
- The master branch (version 0.x) of this project requires HHVM 3.12 and depends on XHP 2.2+ and league/commonmark.
Compliance
Releases of this library will conform to Semantic Versioning.
Our code is intended to comply with PSR-1 and PSR-2. If you find any issues related to standards compliance, please send a pull request!
Features
Instead of using league/commonmark
to actually render the HTML, we use it to parse Markdown into an Abstract Syntax Tree, then we create real bona fide XHP nodes from that AST.
Example
function getXhp(): XHPRoot { $str = <<<EOD # Hello! This is great * Don't you think? EOD; return <axe:markdown text={$str}/>; }
Calling this function will produce XHP nodes exactly like this:
<h1>Hello!</h1><p>This is great</p><ul><li>Don't you think?</li></ul>
You can also supply your own DocParser
in case you've registered custom extensions.
$environment = League\CommonMark\Environment::createCommonMarkEnvironment(); // customize Environment $docParser = new League\CommonMark\DocParser($environment); // customize DocParser echo <axe:markdown text={$text} docParser={$docParser}/>;