-
Get a monthly update on best practices for delivering successful software.
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:
Topics: GWT