Markdown Tooldocumentation for the dotCMS Content Management System

This dotCMS viewtool provides a github flavored markdown (gfm) compatible markdown parser (for the most part). It is built off of the txtmark project by René Jeschke. It provides a viewtool that can be used in dotCMS to parse text/content for gfm.

The following example shows how the ListTool is mapped in the toolbox-xml file:



The Markdown viewtool supports the following two methods:

$markdown.parse()Parses a Markdown formatted string.
$markdown.parseFile()Parses a file containing Markdown formatted text (which may be mixed with Velocity code).

Parse a Markdown-Formatted String




formatted-stringRequiredA Markdown (gfm) formatted string.


The following call to the viewtool when iterating over content in velocity:

$markdown.parse(">**Parse** *this* ~~string~~")

produces the following result:

Parse this string

Parse a Field in a Velocity Pull

In a Velocity pull of content, you can use the $markdown.parse tool to iterate over a text field that has both Velocity and Markdown. The Velocity will execute by default, as long as you are looking at your backend page in Live Mode.


#foreach($con in $dotcontent.pull("+contentType:webPageContent)",10,"modDate desc"))
    $markdown.parse($content.getRaw("$con.body"))  ##body field Velocity executes, gets the raw field string AND displays text in Markdown format

Parse a File in Markdown Format

You can parse a file that contains Markdown-formatted text using the $markdown.parseFile() method. The parseFile() method supports both pain Markdown files and files which combine both Markdown and Velocity code.


$markdown.parseFile(file_name, parse_velocity)


file_nameRequiredThe URL of the file to be parsed.
parse_velocityfalseA boolean flag specifying whether the contents should be parsed for Velocity as well as Markdown.


Files Containing Markdown Only

If a file contains only Markdown text (and no Velocity code), you can parse the file using either of the following calling conventions:

$markdown.parseFile("/application/", false)

Combined Markdown and Velocity

To parse a file that contains both Velocity and Markdown, you must supply a value of true to the parse_velocity parameter:

$markdown.parseFile("/application/", true)

Files on a Different Host

To parse a file on a different site (hosted in the same dotCMS instance), include the site name specification when referencing the file:


This parses the file /application/ on the site


For more information on this viewtool, please see the following documentation in the dotCMS Javadocs: