Hello,
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?
Because Markdown Extra is written in PHP, you'd think it would be pretty easy to bolt this in. 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. So maybe it would make sense to write something that would convert the mediawiki text into markdown at the time of editing?
Thanks, Simon
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
On 5/24/07 10:04 AM, "Ian Smith" ismith@good.com wrote:
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:
Thanks for your reply, Ian. I like this approach. My first step in trying to implement this was to install UsenetSyntax and make sure it works. Alas, I installed UsenetSyntax and found that it doesn't work with the current version (1.10.0) of MediaWiki. Here's my sandbox test page: http://simondorfman.com/wiki/Sandbox:test
Maybe I'm doing something wrong. Do you have UsenetSyntax working on a 1.10.0 install?
Thanks, Simon
P.S.-I started a page to help with the writing of this extension and eventually act as the release page: http://www.mediawiki.org/wiki/Extension:MarkdownSyntax
Hi Simon,
I'm the author of the aforementioned Usenet syntax extension. I have not tested it on anything higher than 1.9.x - but I doubt that's the problem.
I created what I call a "Meta Extension" - an extension which is made to be hooked into and built upon by other extensions called ExtendedSyntaxParser:
http://jimbojw.com/wiki/index.php?title=ExtendedSyntaxParser
The UsenetSyntax extension requires this to be installed first.
Without going into too much detail, the current implementation of ExtendedSyntaxParser, while operating fine by itself, is not amicable to running along side certain other kinds of extensions. It's something that I've wanted to revisit, but haven't had time to do so just yet.
Good luck!
-- Jim R. Wilson (jimbojw)
On 5/26/07, Simon Dorfman emaillists@simondorfman.com wrote:
On 5/24/07 10:04 AM, "Ian Smith" ismith@good.com wrote:
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:
Thanks for your reply, Ian. I like this approach. My first step in trying to implement this was to install UsenetSyntax and make sure it works. Alas, I installed UsenetSyntax and found that it doesn't work with the current version (1.10.0) of MediaWiki. Here's my sandbox test page: http://simondorfman.com/wiki/Sandbox:test
Maybe I'm doing something wrong. Do you have UsenetSyntax working on a 1.10.0 install?
Thanks, Simon
P.S.-I started a page to help with the writing of this extension and eventually act as the release page: http://www.mediawiki.org/wiki/Extension:MarkdownSyntax
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Thanks for your reply, Jim! I had discovered the need for the ExtendedSyntaxParser while reading through the code, but it still wasn't working. But your comment about it being "not amicable to running along side certain other kinds of extensions" led me to try turning off the "TabbedData extension" and sure enough, it works now!
Now I can start hacking at the MarkdownSyntax extension...
Thanks, Simon
On 5/27/07 12:42 PM, "Jim Wilson" wilson.jim.r@gmail.com wrote:
Hi Simon,
I'm the author of the aforementioned Usenet syntax extension. I have not tested it on anything higher than 1.9.x - but I doubt that's the problem.
I created what I call a "Meta Extension" - an extension which is made to be hooked into and built upon by other extensions called ExtendedSyntaxParser:
http://jimbojw.com/wiki/index.php?title=ExtendedSyntaxParser
The UsenetSyntax extension requires this to be installed first.
Without going into too much detail, the current implementation of ExtendedSyntaxParser, while operating fine by itself, is not amicable to running along side certain other kinds of extensions. It's something that I've wanted to revisit, but haven't had time to do so just yet.
Good luck!
-- Jim R. Wilson (jimbojw)
On 5/26/07, Simon Dorfman emaillists@simondorfman.com wrote:
On 5/24/07 10:04 AM, "Ian Smith" ismith@good.com wrote:
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:
Thanks for your reply, Ian. I like this approach. My first step in trying to implement this was to install UsenetSyntax and make sure it works. Alas, I installed UsenetSyntax and found that it doesn't work with the current version (1.10.0) of MediaWiki. Here's my sandbox test page: http://simondorfman.com/wiki/Sandbox:test
Maybe I'm doing something wrong. Do you have UsenetSyntax working on a 1.10.0 install?
Thanks, Simon
P.S.-I started a page to help with the writing of this extension and eventually act as the release page: http://www.mediawiki.org/wiki/Extension:MarkdownSyntax
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org