Markdown Taglib

The markdown-taglib is a JSP tag library used to render Markdown text to HTML.

It uses pegdown. Pegdown is a pure Java library for clean and lightweight Markdown processing.

Build Status

Deprecation note

As the upstream project pegdown was deprecated all my related projects deprecated too.


markdown-taglib is licensed under the Apache License v2.0


Add Maven dependency


Maven Central

Manual installation

Download the jar of latest version from the download page on Bintray. Download the jar of markdown-options too from the download page on Bintray.


Other Markdown Taglib dependencies:

  • asm: asm, asm-analysis, asm-tree and asm-util - v5.0.3 or better;
  • parboiled: parboiled-core and parboiled-java - v1.1.7 or better;
  • pegdown: v1.6.0 or better;
  • slf4j: slf4j-api v1.7.7 or better;
  • any slf4j provider if you need logging.

Declare in JSP

<%@ taglib uri='' prefix ='md' %>

Using the Markdown Taglib

Render tag with text attribute:

<md:render text="Markdown _is_ __cool__!"/>

Another render tag with text and options attributes:

<md:render options="quotes" text="Markdown _is_ __cool__!"/>

Render tag with JSP body:

Markdown _is_ __cool__!

Using the config tag:

<md:config options="smarts">
    <md:render text="Markdown _is_ __cool__!"/>
    <md:render options="smarts">
        Use parent options...
    <md:render options="quotes">
        Use with additional options...
        Cute <<quotes>>
    <md:render options="none" overwriteConfigOptions="true">
        Overwrite config's options...

Supported options

Use these names (any case):

  • Abbreviations: PHP Markdown Extra style abbreviations;
  • All: all available options except HTML ones, AtxHeaderSpace, ExtraAnchorinks, ForceListItemParagraph, RelaxedHorizontalRules, TaskListItems;
  • Anchorlinks: enables anchor links in headers;
  • AtxHeaderSpace: requires a space char after Atx # header prefixes;
  • Autolinks: enables plain autolinks the way github flavoured markdown implements them;
  • DefinitionLists: PHP Markdown Extra style definition lists;
  • ExtraAnchorinks: generate anchor links for headers using complete contents of the header;
  • FencedCodeBlocks: PHP Markdown Extra style fenced code blocks;
  • ForceListItemParagraph: force List and Definition Paragraph wrapping if it includes more than just a single paragraph;
  • Hardwraps: enables the parsing of hard wraps as HTML linebreaks;
  • None: the default, standard markup mode without any extensions, overwrites other options if uses;
  • Quotes: pretty single and double quotes;
  • RelaxedHorizontalRules: allow horizontal rules without a blank line following them;
  • Smarts: pretty ellipses, dashes and apostrophes;
  • Smartypants: smarts + quotes;
  • Strikethrough: support ~~strikethroughs~~ as supported in Pandoc and Github;
  • SuppressAllHtml: suppresses HTML blocks as well as inline HTML tags;
  • SuppressHtmlBlocks: suppresses HTML blocks;
  • SuppressInlineHtml: suppresses inline HTML tags;
  • Tables: table support similar to what Multimarkdown offers;
  • TaskListItems: GitHub style task list items: - [ ] and - [x];
  • Wikilinks: support [[Wiki-style links]].

See more details on Options class page.

Demo application

Feel free to checkout or download the demo web-application.


API Specification

Markdown Taglib 1.1.0 API

Crafted with jEdit