View Source Panpipe.Pandoc (Panpipe v0.3.1)

Wrapper around the pandoc CLI.

See the Pandoc Manual.

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.

Functions

api_version()

The Pandoc API version against which Panpipe operates.

This version will be used in the generated Pandoc documents.

ast(input_or_opts, opts \\ nil)

Returns the Pandoc AST of the input.

ast!(input_or_opts, opts \\ nil)

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

call(input_or_opts, opts \\ nil)

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}

call!(input_or_opts, opts \\ nil)

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

data_dir()

The data directory of the Pandoc runtime Panpipe is using.

extensions()

The list of available Pandoc extension.

highlight_languages()

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

highlight_styles()

The list of highlighting styles supported by Pandoc.

input_formats()

The list of input formats supported by Pandoc.

output_formats()

The list of output formats supported by Pandoc.

version()

The version of the Pandoc runtime Panpipe is using.