Grails Markdown Plugin 0.1 Released
2009/10/6I’ve just released a quick plugin that I put together tonight to help render markdown text as HTML within a grails application. It leverages the MarkdownJ library.
I’m a big fan of storing information in markdown format as it is easy to read, easy to write, and easy to transform. A number of big websites like stackoverflow.com support the entry and display of markdown text to help people format their questions and answers without having to remember to properly format HTML.
If you’re unfamiliar with Markdown there are a number of good references on it’s use.
The grails markdown plugin is a very basic plugin. Currently, it just wraps the markdown libarary with a single TagLib that lets you easily render html from a markdown string within your gsp pages.
To install it, just type:
grails install-plugin markdown
To use it in your gsp file:
<markdown:renderHtml> The *four* cardinal directions are - North - South - East - West </markdown:renderHtml>
renders the html:
<p>The <em>four</em> cardinal directions are</p>
<ul>
<li>North</li>
<li>South</li>
<li>East</li>
<li>West</li>
</ul>Or you can use the “text” attribute of the taglib:
<markdown:renderHtml text="${post.body}"/>
See the Grails Markdown Wiki and source for more details.
There are 3 comments in this article: