bfrohs/markdown

This package is abandoned and no longer maintained. The author suggests using the league/commonmark package instead.

WIP: Markdown parser for PHP

dev-master 2013-10-31 17:05 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:27:52 UTC


README

Build Status

Important: This is an experiment and may be changed, rebased, or trashed at any point. Use extreme caution before using this code.

A few things to track:

Developer-friendly markdown parser for PHP.

Using

// 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>

Differences from Dingus

  • Inter-element whitespace is discarded

  • Whitespace is collapsed into a single space

  • Empty elements are output without trailing slash (ie, <br> instead of <br />)

  • Currently no support for:

    • html <div>
    • entities &quot;
    • autolinks <http://example.com/>
    • code blocks <?php
    • reference links [foo][]