Export to mediawiki format

's Avatar

arebassa

12 May, 2012 12:12 PM

Dear Mr/Mrs

I'm very newbie with markdown and I just purchased marked from the MAC. I have to write a lot of documentation in mediawiki syntax and I was wondering which is the best way to export to it. Is there any option in marked?

Thank you very much

Arnau

  1. Support Staff 1 Posted by Brett on 13 May, 2012 04:32 PM

    Brett's Avatar

    I'm not sure I understand the question. Marked is primarily designed to convert from formats like Markdown and MediaWiki to HTML, PDF, etc. Is that what you're wanting to do? If so, you need to add a custom processor to Marked to handle the wiki format. There are a couple available, but nothing perfect that I've found so far.

    The easiest and most accurate way I've found so far is to use the rubygem wikicloth. If you're comfortable with a little command line work, you just need to run gem install wikicloth (you may have to run sudo gem install wikicloth if the first one doesn't work). Then create a shell script that contains:

     #!/usr/bin/ruby
    
     require 'rubygems'
     require 'wikicloth'
    
     @wiki = WikiCloth::Parser.new({ :data => ARGF.read })
    
     puts @wiki.to_html
    

    Save that as wiki2html.rb anywhere in your home folder or in /usr/local/bin/. Then run chmod a+x /path/to/wiki2html.rb and add /path/to/wiki2html.rb as your custom processor in Marked (substituting the actual path to wiki2html.rb where needed). After that, Marked should be able to handle wiki markup for you.

    Let me know if that helps.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac