Panpipe.Pandoc (Panpipe v0.3.0) View Source

Wrapper around the pandoc CLI.

See the Pandoc Manual.

Link to this section Summary

Functions

The Pandoc API version against which Panpipe operates.

Returns the Pandoc AST of the input.

Calls ast/2 and delivers the result directly in success case, otherwise raises an error.

Calls the pandoc command.

Calls call/2 and delivers the result directly in success case, otherwise raises an error.

The data directory of the Pandoc runtime Panpipe is using.

The list of available Pandoc extension.

The list of languages for which Pandoc supports syntax highlighting in code blocks.

The list of highlighting styles supported by Pandoc.

The list of input formats supported by Pandoc.

The list of output formats supported by Pandoc.

The version of the Pandoc runtime Panpipe is using.

Link to this section Functions

The Pandoc API version against which Panpipe operates.

This version will be used in the generated Pandoc documents.

Link to this function

ast(input_or_opts, opts \\ nil)

View Source

Returns the Pandoc AST of the input.

Link to this function

ast!(input_or_opts, opts \\ nil)

View Source

Calls ast/2 and delivers the result directly in success case, otherwise raises an error.

Link to this function

call(input_or_opts, opts \\ nil)

View Source

Calls the pandoc command.

For a description of the arguments refer to the Pandoc User’s Guide.

You can provide any of Pandoc's supported options in their long form without the leading double dashes and all other dashes replaced by underscores.

Other than that, the only difference are a couple of default values:

  • Input is provided either directly as a string of content as the first argument or via the input option when it is a path to a file
  • Extensions for the input and output format can be specified by providing a tuple with the format and either a list of extensions to be enabled or a map with the keys enable and disable.
  • Flag options must provide a true value, eg. the standalone option can be set with the option standalone: true

Examples

iex> "# A Markdown Document\nLorem ipsum" |> Panpipe.Pandoc.call()
{:ok, ~s[<h1 id="a-markdown-document">A Markdown Document</h1>\n<p>Lorem ipsum</p>\n]}

iex> "# A Markdown Document\n..." |> Panpipe.Pandoc.call(output: "test/output/example.html")
{:ok, nil}

iex> Panpipe.Pandoc.call(input: "test/fixtures/example.md")
{:ok, ~s[<h1 id="a-markdown-document">A Markdown Document</h1>\n<p>Lorem ipsum</p>\n]}

iex> Panpipe.Pandoc.call(input: "test/fixtures/example.md", output: "test/output/example.html")
{:ok, nil}
Link to this function

call!(input_or_opts, opts \\ nil)

View Source

Calls call/2 and delivers the result directly in success case, otherwise raises an error.

The data directory of the Pandoc runtime Panpipe is using.

The list of available Pandoc extension.

The list of languages for which Pandoc supports syntax highlighting in code blocks.

The list of highlighting styles supported by Pandoc.

The list of input formats supported by Pandoc.

The list of output formats supported by Pandoc.

The version of the Pandoc runtime Panpipe is using.