p:markdown-to-html (3.1) 

Converts a Markdown document into HTML.

Summary

<p:declare-step type="p:markdown-to-html">
  <input port="source" primary="true" content-types="text" sequence="false"/>
  <output port="result" primary="true" content-types="html" sequence="false"/>
  <option name="parameters" as="map(xs:QName,item()*)?" required="false" select="()"/>
</p:declare-step>

The p:markdown-to-html step converts a Markdown document appearing on its source port into HTML. The result appears on the result port.

Ports:

Port

Type

Primary?

Content types

Seq?

Description

source

input

true

text

false

The Markdown document to transform.

result

output

true

html

false

The resulting HTML document.

Options:

Name

Type

Req?

Default

Description

parameters

map(xs:QName,item()*)?

false

()

Parameters used to control the conversion. The XProc specification does not define any parameters for this option. A specific XProc processor (or renderer used) might define its own.

Description

The p:markdown-to-html step converts a Markdown document appearing on its source port into HTML. There are several flavors of Markdown, for instance CommonMark. Which Markdown flavors are supported by p:markdown-to-html is implementation-defined and therefore dependent on the XProc processor used. The resulting HTML appears on the result port.

Examples

Basic usage

Assume we have a Markdown document that looks like this:

# Example Markdown document

This is an example of a Markdown document to show what the conversion to HTML by `p:markdown-to-html` looks like.

We can convert this into HTL using p:markdown-to-html:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">

  <p:input port="source"/>
  <p:output port="result"/>

  <p:markdown-to-html/>

</p:declare-step>

Result document:

<html xmlns="http://www.w3.org/1999/xhtml">
   <head/>
   <body>
      <h1>Example Markdown document</h1>
      <p>This is an example of a Markdown document to show what the conversion to HTML by <code>p:markdown-to-html</code> looks like.</p>
   </body>
</html>

Additional details

  • The document appearing on the result port only has a content-type property. It has no other document-properties (also no base-uri).

Reference information

This description of the p:markdown-to-html step is for XProc version: 3.1. This is a required step (an XProc 3.1 processor must support this).

The formal specification for the p:markdown-to-html step can be found here.

The p:markdown-to-html step is part of categories:

The p:markdown-to-html step is also present in version: 3.0.