PHPackages                             jmcmanus/pagedown-extra - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. jmcmanus/pagedown-extra

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

jmcmanus/pagedown-extra
=======================

This is a collection of Pagedown plugins to enable support for Markdown Extra syntax. Open demo/demo.html to try it yourself. To run the tests, just open spec/SpecRunner.html in your browser. Or, to run a browser-less test from the command line as travis-ci would, run bundle install followed by bundle exec rake. You'll need Ruby and the rake gem if you use the second method.

v0.1.0(8y ago)01461JavaScript

Since Jun 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kael-shipman/pagedown-extra)[ Packagist](https://packagist.org/packages/jmcmanus/pagedown-extra)[ RSS](/packages/jmcmanus-pagedown-extra/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

\#Overview

This is a collection of [Pagedown](http://code.google.com/p/pagedown/ "Pagedown - Google Code") plugins to enable support for Markdown Extra syntax. Open `demo/demo.html` to try it yourself. To run the tests, just open `spec/SpecRunner.html` in your browser. Or, to run a browser-less test from the command line as travis-ci would, run `bundle install` followed by `bundle exec rake`. You'll need Ruby and the rake gem if you use the second method.

[![travis](https://camo.githubusercontent.com/0af4b3b540cebc35f3084e9eeb12ce69bf5468b16342d04b7eade55cf37e0502/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6a6d636d616e75732f70616765646f776e2d65787472612e706e67)](https://camo.githubusercontent.com/0af4b3b540cebc35f3084e9eeb12ce69bf5468b16342d04b7eade55cf37e0502/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6a6d636d616e75732f70616765646f776e2d65787472612e706e67)

Usage
-----

[](#usage)

First, make sure you have the most recent version of Pagedown (as of Feb 3, 2013), as it adds more powerful hooks that this implementation relies on.

In order to use the extensions, you'll need to include `Markdown.Extra.js` after the Pagedown sources. Check out the demo for a working example.

```
// create a pagedown converter - regular and sanitized versions are both supported
var converter = new Markdown.Converter();
// tell the converter to use Markdown Extra
Markdown.Extra.init(converter);
// convert some markdown
var html = converter.makeHtml("| A | B |\n| :-: | :-: |\n| 1 | 2 |");
```

To use this in Node.js with Pagedown:

```
var pagedown = require("pagedown");
var converter = new pagedown.Converter();
var pagedownExtra = require("pagedown-extra");
pagedownExtra.init(converter);
```

If you're using multiple converters on the same page, you can just call `Markdown.Extra.init` once for each converter and you're all set.

If you want, you can choose to use only a subset of the extensions currently supported:

```
Markdown.Extra.init(converter, {extensions: ["tables", "fenced_code_gfm", "def_list"]});
```

See the Extension/Option Reference below for a complete list.

### [Tables](http://michelf.ca/projects/php-markdown/extra/#table)

[](#tables)

The following markdown:

```
| Item      | Value | Qty |
| --------- | -----:|:--: |
| Computer  | $1600 | 5   |
| Phone     |   $12 | 12  |
| Pipe      |    $1 |234  |
```

will render to something like this depending on how you choose to style it:

ItemValueQtyComputer$16005Phone$1212Pipe$1234You can also specify a class for the generated tables using `Markdown.Extra.init(converter, {table_class: "table table-striped"})` for instance.

Span-level markdown inside of table cells will also be converted.

### [Fenced Code Blocks](http://github.github.com/github-flavored-markdown/)

[](#fenced-code-blocks)

Fenced code blocks are supported à la GitHub. This markdown:

```
```
var x = 2;
```

```

Will be transformed into:

```

    var x = 2;

```

You can specify a syntax highlighter in the options object passed to `Markdown.Extra.init`, in order to generated html compatible with either [google-code-prettify](http://code.google.com/p/google-code-prettify/ "Prettify")or [Highlight.js](http://softwaremaniacs.org/soft/highlight/en/ "HighlightJs"):

```
// highlighter can be either `prettify` or `highlight`
Markdown.Extra.init(converter, {highlighter: "prettify"});
```

If either of those is specified, the language type will be added to the code tag, e.g. ``, otherwise you just get the standard `` as in PHP Markdown Extra. If `prettify` is specified, `` also becomes ``. Otherwise, the markup is the same as what Pagedown produces for regular indented code blocks. For example, when using `{highlighter: "prettify"}` as shown above, this:

```
```javascript
var x = 2;
```

```

Would generate the following html:

```

    var x = 2;

```

### [Definition Lists](http://michelf.ca/projects/php-markdown/extra/#def-list)

[](#definition-lists)

```
Term 1
:   Definition 1

Term 2
:   This definition has a code block.

        code block
```

becomes:

```

  Term 1

    Definition 1

  Term 2

    This definition has a code block.
    code block

```

Definitions can contain both inline and block-level markdown.

### [Footnotes](https://github.com/fletcher/MultiMarkdown/blob/master/Documentation/MultiMarkdown%20User%27s%20Guide.md#footnotes)

[](#footnotes)

```
Here is a footnote[^footnote].

  [^footnote]: Here is the *text* of the **footnote**.
```

becomes:

```
Here is a footnote1.

Here is the text of the footnote. ↩

```

### [Special Attributes](http://michelf.ca/projects/php-markdown/extra/#spe-attr)

[](#special-attributes)

You can add class and id attributes to headers and gfm fenced code blocks.

```
``` {#gfm-id .gfm-class}
var foo = bar;
```

## A Header {#header-id}

### Another One ### {#header-id .hclass}

Underlined  {#what}
==========

```

### [SmartyPants](http://daringfireball.net/projects/smartypants/)

[](#smartypants)

SmartyPants extension converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:

ASCIIHTMLSingle backticks`'Isn't this fun?'`‘Isn’t this fun?’Quotes`"Isn't this fun?"`“Isn’t this fun?”Dashes`This -- is an en-dash and this --- is an em-dash`This – is an en-dash and this — is an em-dash### [Newlines](https://help.github.com/articles/github-flavored-markdown#newlines)

[](#newlines)

Newlines à la GitHub (without the need of two white spaces):

```
Roses are red
Violets are blue
```

becomes:

```
Roses are red
Violets are blue
```

### [Strikethrough](https://help.github.com/articles/github-flavored-markdown#strikethrough)

[](#strikethrough)

Strikethrough à la GitHub:

```
~~Mistaken text.~~
```

becomes:

```
Mistaken text.
```

Extension / Option Reference
----------------------------

[](#extension--option-reference)

You can enable all of the currently supported extensions with `{extensions: "all"}`. This is also the default. If specifying multiple extensions, you must provide them as an array. Here is a list of the current and planned options and extensions. I've chosen to use the same naming scheme as the excellent Python Markdown library.

ExtensionDescriptionfenced\_code\_gfmGFM fenced code blockstablesPretty tables!def\_listDefinition listsattr\_listSpecial attributes list for headers and fenced code blocksfootnotesFootnotessmartypantsSmartyPantsnewlinesGFM newlinesstrikethroughGFM strikethrough*smart\_strong*No strong emphasis in the middle of words*abbr*Abbreviations*fenced\_code*PHP Markdown Extra fenced code blocksOptionDescriptiontable\_classClass added to all markdown tables. Useful when using frameworks like bootstrap.highlighterCode highlighter. Must be one of `highlight` and `prettify` for now*Italicized extensions are planned, and will be added in roughly the order shown*

See PHP Markdown Extra's [documentation](http://michelf.ca/projects/php-markdown/extra/#table "Markdown Extra Table Documentation") for a more complete overview of syntax. In situations where it differs from how things are done on GitHub -- alignment of table headers, for instance -- I've chosen compatibility with gfm, which seems to be quickly becoming the most widely used markdown implementation.

### Special Characters

[](#special-characters)

Markdown Extra adds two new special characters, `|` and `:`, that can be escaped by preceding them with `\`. Doing so will cause the escaped character to be ignored when determining the extent of code blocks and definition lists.

\##License

See LICENSE.txt

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3245d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b76588c1d06ed54f5f5fe06e466d044b0527eb6e1b68a8e3dccd13e447fa43eb?d=identicon)[kael-shipman](/maintainers/kael-shipman)

---

Top Contributors

[![benweet](https://avatars.githubusercontent.com/u/1005257?v=4)](https://github.com/benweet "benweet (44 commits)")[![jmcmanus](https://avatars.githubusercontent.com/u/1134654?v=4)](https://github.com/jmcmanus "jmcmanus (41 commits)")[![jkunkee](https://avatars.githubusercontent.com/u/653553?v=4)](https://github.com/jkunkee "jkunkee (2 commits)")[![Darkhogg](https://avatars.githubusercontent.com/u/237337?v=4)](https://github.com/Darkhogg "Darkhogg (1 commits)")[![kael-shipman](https://avatars.githubusercontent.com/u/3475586?v=4)](https://github.com/kael-shipman "kael-shipman (1 commits)")

---

Tags

markdownmarkdown-extra

### Embed Badge

![Health badge](/badges/jmcmanus-pagedown-extra/health.svg)

```
[![Health](https://phpackages.com/badges/jmcmanus-pagedown-extra/health.svg)](https://phpackages.com/packages/jmcmanus-pagedown-extra)
```

###  Alternatives

[erusev/parsedown

Parser for Markdown.

15.0k151.8M727](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M700](/packages/league-commonmark)[cebe/markdown

A super fast, highly extensible markdown parser for PHP

1.0k32.5M136](/packages/cebe-markdown)[michelf/php-markdown

PHP Markdown

3.5k52.4M344](/packages/michelf-php-markdown)[erusev/parsedown-extra

An extension of Parsedown that adds support for Markdown Extra.

84314.8M192](/packages/erusev-parsedown-extra)[league/html-to-markdown

An HTML-to-markdown conversion helper for PHP

1.9k28.6M196](/packages/league-html-to-markdown)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
