PHP 5 port of Markdown, plugin-based

Michel Fortin michel.fortin at michelf.com
Wed Aug 16 10:16:25 EDT 2006


Le 16 août 2006 à 9:39, Paul M Jones a écrit :


> So the functional/procedural PHP-Markdown is a little more than

> twice as fast as plugin-capable Solar_Markdown. If you transform

> the source text anew on every page load, this might be an issue; if

> you cache the transformed text for subsequent page loads, it's

> probably not.


Interesting numbers. PHP Markdown has been optimized quite much, it'd
probably be hard to beat, speed-wise, for another PHP implementation.

I'm preparing a version of PHP Markdown which is more extendable too,
and it'll probably be as fast as the current version. The idea is
very simple: change `runSpanGamut` and `runBlockGamut` so that they
execute a configurable list of functions instead of the hard-coded
process we have today. This way, a subclass of Markdown_Parser will
be able to add its own functions wherever it wants without having to
redefine the gamut function entirely.

I'm also changing the way span elements are parsed to prevent
**things *like** this* from generating invalid markup. It may or may
not be slower once ready since I'm also removing other code obsoleted
by the process.

- - -

Interesting: I just found out that Solar Markdown is using the HTML
Tidy library (built into PHP 5) to fix bad XHTML at the end of the
process. That's clever. How come you've not mentioned it before? :-)


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/




More information about the Markdown-Discuss mailing list