Simon Dorfman:
I'd like to extend MediaWiki to work with the Markdown Extra syntax ( http://www.michelf.com/projects/php-markdown/ ).
Two questions:
- Does anyone know of anyone else who has already started work on
something like this? (I did some searching, but didn't find anything.)
- 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:
http://www.mediawiki.org/wiki/Extension:UsenetSyntax
The tricky part is that I'd like be able to just write pages in Markdown Extra syntax but still have double brackets
create
new pages. One idea is to write an extension and put the Markdown
Extra
stuff between XML-style tags: <markdown> .... </markdown>. But I
think
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:
http://meta.wikimedia.org/wiki/TabbedData_extension
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.
Ian