PHPackages                             bfrohs/markdown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bfrohs/markdown

Abandoned → [league/commonmark](/?search=league%2Fcommonmark)ArchivedLibrary

bfrohs/markdown
===============

WIP: Markdown parser for PHP

026PHP

Since Oct 31Pushed 12y ago1 watchersCompare

[ Source](https://github.com/bfrohs/php-md)[ Packagist](https://packagist.org/packages/bfrohs/markdown)[ RSS](/packages/bfrohs-markdown/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/6db9b88c1e27a142a5182366639414d92dab502e77a46876de6974094a3ec12d/68747470733a2f2f7472617669732d63692e6f72672f6266726f68732f7068702d6d642e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/bfrohs/php-md)

**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:

- [Core Syntax milestone](https://github.com/bfrohs/php-md/issues?milestone=1&state=open)
- [GitHub Flavored Markdown milestone](https://github.com/bfrohs/php-md/issues?milestone=2&state=open)

---

Developer-friendly markdown parser for PHP.

Using
=====

[](#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; // Some string using markdown.
```

Differences from [Dingus](http://daringfireball.net/projects/markdown/dingus)
=============================================================================

[](#differences-from-dingus)

- [Inter-element whitespace](http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#inter-element-whitespace) is discarded
- Whitespace is collapsed into a single space
- Empty elements are output without trailing slash (ie, `` instead of ``)
- Currently no support for:

    - html ``
    - entities `&quot;`
    - autolinks ``
    - code blocks `
