Name

cx:pegdown — Convert Markdown text to XHTML.

Synopsis

<p:declare-step type="cx:pegdown" xmlns:cx="http://xmlcalabash.com/ns/extensions">
     <p:input port="source"/>
     <p:output port="result"/>
     <p:option name="max-parsing-time"/>                           <!-- integer -->
     <p:option name="smarts" select="'false'"/>                    <!-- boolean -->
     <p:option name="quotes" select="'false'"/>                    <!-- boolean -->
     <p:option name="abbreviations" select="'false'"/>             <!-- boolean -->
     <p:option name="hardwraps" select="'false'"/>                 <!-- boolean -->
     <p:option name="autolinks" select="'false'"/>                 <!-- boolean -->
     <p:option name="tables" select="'false'"/>                    <!-- boolean -->
     <p:option name="definitions" select="'false'"/>               <!-- boolean -->
     <p:option name="fenced-code-blocks" select="'false'"/>        <!-- boolean -->
     <p:option name="wikilinks" select="'false'"/>                 <!-- boolean -->
     <p:option name="strikethrough" select="'false'"/>             <!-- boolean -->
     <p:option name="anchorlinks" select="'false'"/>               <!-- boolean -->
     <p:option name="suppress-html-blocks" select="'false'"/>      <!-- boolean -->
     <p:option name="suppress-inline-html" select="'false'"/>      <!-- boolean -->
     <p:option name="suppress-all-html" select="'false'"/>         <!-- boolean -->
     <p:option name="plugins"/>                                    <!-- string -->
     <p:option name="link-renderer"/>                              <!-- string -->
     <p:option name="verbatim-serializer"/>                        <!-- string -->
     <p:option name="to-html-serializer-plugins"/>                 <!-- string -->
</p:declare-step>

Description

This step converts Markdown documents into XHTML.

The cx:pegdown step defines a number of options. The list is intended to be comprehensive with respect to the attributes and options that can be passed to the PegDown formatter. The names reflect the names used by the project, as far as I can tell. They are: max-parsing-time, smarts, quotes, abbreviations, hardwraps, autolinks, tables, definitions, fenced-code-blocks, wikilinks, strikethrough, anchorlinks, suppress-html-blocks, suppress-inline-html, suppress-all-html, plugins, link-renderer, verbatim-serializer, to-html-serializer-plugins

The max-parsing-time is a number of milliseconds. Most of the rest of the options are booleans, defaulting to false. The last few options identify extension classes:

plugins

The fully qualified classname for a plugin class.

link-renderer

The fully qualified classname for a link rendering class.

verbatim-serializer

A sequence of name/classname pairs for verbatim serialization.

to-html-serializer-plugins

A list of fully qualifieid classnames for HTML serialization.

For example, consider this Markdown file:

# XML Calabash pegdown Step

This repository contains an [XML Calabash](http://github.com/ndw/xmlcalabash1)
1.1 extension steps that supports the
[pegdown](https://github.com/sirthias/pegdown) MarkDown to HTML
translator.

This step should work with either Saxon 9.5 or Saxon 9.6.

## Installation

For standalone installation, get the most recent release from the project
[releases](http://github.com/ndw/xmlcalabash1-pegdown/releases) page.
The release distributed there includes
relevant dependencies. Unpack it somewhere on your system and add the
included, top-level `jar` file to your class path.

If you're using Maven, you can also get it from there. Note, however,
that the Maven distribution includes a POM file that identifies other
dependencies that must also be downloaded. You'll need them too, which
happens naturally if you're including the Maven dependency in some
other Maven project. If you just grab the `jar` from Maven and don't
get the other dependencies, you're likely to find that the step
doesn't work because of some missing dependencies.

Running this through cx:pegdown produces:

<html>
   <head/>
   <body>
      <h1>XML Calabash pegdown Step</h1>
      <p>This repository contains an <a href="http://github.com/ndw/xmlcalabash1">XML Calabash</a> 1.1 extension steps that supports the <a href="https://github.com/sirthias/pegdown">pegdown</a> MarkDown to HTML translator.</p>
      <p>This step should work with either Saxon 9.5 or Saxon 9.6.</p>
      <h2>Installation</h2>
      <p>For standalone installation, get the most recent release from the project <a href="http://github.com/ndw/xmlcalabash1-pegdown/releases">releases</a> page. The release distributed there includes relevant dependencies. Unpack it somewhere on your system and add the included, top-level <code>jar</code> file to your class path.</p>
      <p>If you're using Maven, you can also get it from there. Note, however, that the Maven distribution includes a POM file that identifies other dependencies that must also be downloaded. You'll need them too, which happens naturally if you're including the Maven dependency in some other Maven project. If you just grab the <code>jar</code> from Maven and don't get the other dependencies, you're likely to find that the step doesn't work because of some missing dependencies.</p>
   </body>
</html>

Usage

To use this step, you must include its declaration in your pipeline. You can copy the declaration above or import a library that defines this step, such as

http://xmlcalabash.com/extension/steps/pegdown.xpl

Implementation

This step is implemented by the xmlcalabash1-pegdown module. The jar file from that project must be in the class path in order to use this step.