Overview

Plugin-aware text-to-XHTML converter based on Markdown.

This package is ported from John Gruber's » Markdown script in Perl, with many thanks to Michel Fortin for his » PHP Markdown port to PHP 4. Be sure to read up on » Markdown syntax as well.

Unlike Markdown and PHP Markdown, Solar_Markdown is plugin-aware. Every processing rule is a separate class, and classes can be strung together in a manner largely independent of each other (although the order of processing still matters a great deal). The plugin architecture is based on Paul's work from » Text_Wiki.

While the Text_Wiki package is capable of converting to any rendering format, Solar_Markdown only converts to XHTML. If you need to render to something other than XHTML, you may wish to try a two-step output process: from Markdown to XHTML, then from XHTML to your preferred format.

Package

This class is part of the Solar_Markdown package.

Inheritance:

Configuration Keys

  • tab_width: Number of spaces per tab. Default 4.

  • tidy: If empty/false/null, do not use Tidy to post-process the transformed output. If true or a non-empty array, is a set of config options to pass to Tidy when rendering output. See also » http://php.net/tidy. Default false.

  • plugins: An array of plugins for the parser to use, in order.

Constants

None.

Public Properties

The Solar_Markdown class has no public properties; try the list of all properties.

Public Methods

These are all the public methods in the Solar_Markdown class.

You can also view the list of all public, protected, and private methods.

__construct()

Constructor.

__destruct()

Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().

cleanup()

Runs the processed text through each plugin's cleanup() method.

dump()

Convenience method for getting a dump the whole object, or one of its properties, or an external variable.

encode()

Encodes special Markdown characters so they are not recognized when parsing.

escape()

Escapes HTML in source text.

getLink()

Returns the href and title of a named link reference.

getLinks()

Returns an array of all defined link references.

getPlugin()

Returns an internal Markdown plugin object for direct manipulation and inspection.

getTabWidth()

Returns the number of spaces per tab.

isHtmlToken()

Is a piece of text a delimited HTML token?

locale()

Looks up class-specific locale strings based on a key.

prepare()

Prepares the text for processing by running the prepare() method of each plugin, in order, on the source text.

processBlocks()

Runs the source text through all block-type plugins.

processSpans()

Runs the source text through all span-type plugins.

render()

Returns a final rendering of the processed text.

reset()

Resets Markdown and all its plugins for a new transformation.

setLink()

Sets the value of a named link reference.

toHtmlToken()

Saves a pieces of text as HTML and returns a delimited token.

transform()

One-step transformation of source text using plugins.

unEncode()

Un-encodes special Markdown characters.

unHtmlToken()

Replaces all HTML tokens in source text with saved HTML.



Local