The xtpxlib-xdoc component contains the following XProc (1.0) library module:

ModuleDescription
xtpxlib-xdoc.mod.xplLibrary with support pipelines for xdoc and related conversions.

5.1 XProc (1.0) library: xtpxlib-xdoc.mod.xpl

File: xplmod/xtpxlib-xdoc.mod/xtpxlib-xdoc.mod.xpl

Library with support pipelines for xdoc and related conversions.

PrefixNamespace URI
xdochttp://www.xtpxlib.nl/ns/xdoc

5.1.1 Step: xdoc:markdown-to-docbook

Converts the contents of xdoc:MARKDOWN elements into DocBook.

This pipeline checks the incoming XML for xdoc:MARKDOWN elements. The contents of these elements is assumed to contain Markdown. The pipeline tries to convert this into DocBook. The xdoc:MARKDOWN element is removed/unwrapped.

The following rules apply:

  • The contents of an xdoc:MARKDOWN element is stringified (so any child elements are lost).

  • The resulting text can be indented, using space characters only (no tabs!). The non-empty line with the minimum indent is assumed to be its left margin.

  • Only simple Markdown is supported. Specifically:

    • Inline markup for emphasis, bold, code, etc.

    • Links. A link target starting with a % is handled as an internal link (the @xml:id of something in the encompassing DocBook).

    • Code blocks (using three consecutive back-ticks)

    • Headers (these are all converted into the same DocBook bridgehead elements)

  • Specifically not supported (yet?) are tables.

If you add an header-only="true" attribute to the xdoc:MARKDOWN element, only the first paragraph will be output.

PortTypePrimary?Description
sourceinyesAny XML that might contain xdoc:MARKDOWN elements for conversion.
resultoutyesThe same XML but with the xdoc:MARKDOWN element's contents converted into DocBook.