chickadee » pandoc » pandoc-port->sxml

pandoc-port->json pandoc input-format portprocedure
pandoc-port->sxml pandoc input-format portprocedure

These procedures parse markup from various sources.

The pandoc argument is the Pandoc endpoint to use: cli, tar, or server. The next sections explain how to create endpoints.

The ->json procedures return Pandoc's JSON parse tree. The JSON is decoded into the canonical Scheme JSON representation used by SRFI 180, the cjson and medea eggs, etc.: JSON arrays become Scheme vectors, JSON objects become Scheme association lists with symbol keys, and JSON null becomes the symbol 'null.

The ->sxml procedures are like their ->json counterparts, but instead of JSON they return an SXML conversion of Pandoc's parse tree using HTML tags. The parse tree is easy to turn into HTML using one of several Scheme libraries, e.g. Chicken's sxml-transforms egg.

The input-format argument is a symbol, e.g. markdown or html, and is supplied as Pandoc's --from argument or its equivalent for the given endpoint.

An exception is raised if the conversion is not successful.