aboutsummaryrefslogtreecommitdiff
path: root/doc/using-the-pandoc-api.md
blob: 75bf227f13078702832651eccb03712c59585e48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
% Using the pandoc API
% John MacFarlane

Pandoc can be used as a Haskell library, to write your own
conversion tools or power a web application.  This document
offers an introduction to using the pandoc API.

Detailed API documentation at the level of individual functions
and types is available at
<https://hackage.haskell.org/package/pandoc>.

# Pandoc's architecture, and a simple example

Pandoc structure, readers, writers.

example of using a reader.

example of using a writer.

chaining them together.

# The PandocMonad class

Pandoc's functions define computations that can be run in
any instance of the `PandocMonad` typeclass.  Two instances
are provided: `PandocIO` and `PandocPure`. The difference is
that computations run in `PandocIO` are allowed to do IO
(for example, read a file), while computations in `PandocPure`
are free of any side effects.  `PandocPure` is useful when
you want to prevent users from doing anything malicious.

Here's an example of such a computation, from the module
`Text.Pandoc.Class`:

```haskell
-- | Get the verbosity level.
getVerbosity :: PandocMonad m => m Verbosity
```

motivations
Class.

# The Pandoc structure

blocks/inlines

# Readers and writers

getReader, getWriter

# Options

various reader and writer options you can set.
templates
extensions

# Builder

Inlines vs Inline, etc.
Monoid

example: report from CSV data

# Templates and other data files

# Handling errors and warnings

# Generic transformations

Walk and syb for AST transformations

# Filters

just the basic idea of toJSONFilter
the rest can be left to filters.md

# Self-contained


# PDF

# Custom PandocMonad instances

# Creating a front-end

Text.Pandoc.App