Converting from Trac's Wiki Syntax to Markdown

675 views
Skip to first unread message

Guy Rutenberg

unread,
Sep 16, 2014, 3:56:05 PM9/16/14
to trac-...@googlegroups.com
Hi,

I want to convert pages in the Wiki syntax used by Trac to markdown. Is there a good solution?

I found a few very shorts scripts that attempt to do so, but none that really looked promising. I've also considered using WikiParser from trac.wiki to get a DOM tree of the trac wiki and then write code that will convert it to markdown, but I've ran into problems using WikiParser.

I've tried:

from trac.wiki import WikiParser
from trac.core import ComponentManager

wp = WikiParser(ComponentManager())
wp.parse(my_wiki_text)

But the last line simply returns my_wiki_text as is, instead of a WikiDOM tree as the documentations says. Any idea what I did wrong?

Thanks,

Guy

---
http://www.guyrutenberg.com/

RjOllos

unread,
Oct 16, 2014, 9:14:33 PM10/16/14
to trac-...@googlegroups.com
You didn't do anything wrong. The "parse" method hasn't been implemented yet, and the Trac API doesn't produce a WikiDOM tree yet:

You might take a look at this proposal, but I don't know of anything that will directly help you at the moment.

 

Ryan Ollos

unread,
Dec 12, 2014, 6:59:23 PM12/12/14
to trac-...@googlegroups.com
You might have better luck converting the HTML to markdown with a tool such as this one:
http://johnmacfarlane.net/pandoc/
Reply all
Reply to author
Forward
0 new messages