Object-oriented PHP implementation is coming, looking for parties
max at garygolden.me
Wed Oct 26 18:04:21 EDT 2011
My name is Max, I'm a web developer.
I found Markdown convention very useful, I use it everywhere nowadays.
Michel Fortin's markdown-php seems to be the only available PHP implementation.
And, judging by number of people using it, it works well :)
But there is many thing that's keep it from being perfect:
* One large file with functions not being sorted in a logical way.
It makes it hard to understand how it works.
* Despite the fact that it contains classes, it isn't coded
object-oriented. Which greatly affect, again, clarity and
* Script is coded in early ages of PHP, doesn't make use of its new
features and uses obsolete ones.
* It's written much like a Python program. PHP doesn't work that way.
To give Markdown in PHP a new look, I've designed a library, which I
oo-php stands for object-oriented php. It's designed to be easy to use
There is two components Text and Filter.
Text is an entity user works with, it represents text being processed. E.g.:
echo new Markdown_Text($plaintext);
Filter is a superclass and set of specific filters which does actual parsing.
Each specific filter is an object which transforms a single markdown
element to xhtml.
Examples of filters are: Markdown_Filter_Hr,
When user wants to transform markdown these filters are running one by
one resulting to html.
By default, one more special filter is run. It will pass given text to
original Markdown.pl 1.0.1
This way we get parsed markdown even if some filters are not implemented yet.
This feature requires perl, of course. It can be disabled:
Such design allows users to write their own filters, hook into the
process, write plugins etc.
We can compose any chain of filters resulting into different versions,
extra features and other goodies.
You can find source along with documentation at GitHub:
You're most welcome to comment, contribute and, of course, spread the word.
Max Tsepkov (a.k.a. Gary Golden)
A freelancing web engineer
More information about the Markdown-Discuss