Markdown support for GWT in 42 seconds

As promised earlier, here is Markdown support in GWT.

1) Grab Showdown
2) Copy 'showdown.js' to the 'public' directory of your application.
3) Edit your module file:

    <module>        <!-- .... -->        <script src="showdown.js"/>        <!-- .... -->    </module>

4) Use JSNI to invoke Showdown.

    public static native String convert(String text) /*-{        var converter = new $wnd.Showdown.converter();        return converter.makeHtml(text);    }-*/;

5) Invoke 'convert()' as needed.  In my case, I wired it up to a KeyboardListener attached to a TextArea, and had the results placed on an HTML object.

And yes, it's that simple.

Related posts:

  1. Markdown, GWT & Regular Expressions in Groovy
  2. GWT Testing With Groovy? (Heck yeah!)
  3. Making GWT JSON not Quite so Painful
  4. Hacking transparent PNG support into IE6 with IE PNG Fix, CSS and jQuery (part 2 of 2)
  5. My Favorite Monkeys

Topics:

Leave a comment

Powered by WP Hashcash

Launch: Pathfinder Newsletter

    Get a monthly update on best practices for delivering successful software.

    Subscribe via email


    Subscribe via RSS      RSS icon

Topics

Search

WordPress

Comments about this site: info@pathf.com