[Mediawiki-l] Markdown

Ian Smith ismith at good.com
Thu May 24 15:04:44 UTC 2007

Simon Dorfman:
> I'd like to extend MediaWiki to work with the Markdown Extra syntax (
> http://www.michelf.com/projects/php-markdown/ ).
> Two questions:
> 1. Does anyone know of anyone else who has already started work on
> something
> like this? (I did some searching, but didn't find anything.)
> 2. Any ideas on how to implement this?

There's an extension which implements Usenet style syntax (ie. *bold*
and _italics_) in MediaWiki -- and it's really simple.  I think that
this will at least give you an idea of how such an extension can be
hooked into MW; in fact, you could probably use the extension as a base,
cut out the Usenet formatting code, and paste in the Markdown code:


> The tricky part is that I'd like be able to just
> write pages in Markdown Extra syntax but still have double brackets
> new pages.  One idea is to write an extension and put the Markdown
> stuff between XML-style tags: <markdown> .... </markdown>.  But I
> that
> wouldn't allow the creation of new wikipage links inside those tags.

If you do it that way (which would involve a different way of hooking it
in), then you can still have MediaWiki syntax work inside the tags, by
calling the MediaWiki parser on the text.  Have a look at this:


Inside the <tab> ... </tab> tags, it converts tabbed data to a table;
but at the end of hookTab(), it calls the parser, so that any remaining
MediaWiki syntax is handled.  Sounds like what you need.  Just replace
the table conversion with the Markdown stuff.

> So
> maybe it would make sense to write something that would convert the
> mediawiki text into markdown at the time of editing?

That's yet another approach... personally, I would allow my users to
write in either syntax, and keep it the way they wrote it.


More information about the MediaWiki-l mailing list