diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-05-09 17:25:55 -0600 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-05-09 19:11:34 -0600 |
commit | f69f1101e6689745cf5dea8276ba11d723b43ccf (patch) | |
tree | 44ad37d48e0b6d5dd1dd582dd2473b5418aeeb98 | |
parent | 41a3ac9da99c2701fa7e6adbc85da91f191620f4 (diff) | |
download | pandoc-f69f1101e6689745cf5dea8276ba11d723b43ccf.tar.gz |
Update doc/using-the-pandoc-api.md for new reader types.
-rw-r--r-- | doc/using-the-pandoc-api.md | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/doc/using-the-pandoc-api.md b/doc/using-the-pandoc-api.md index 19ce8b274..d6eb9e15f 100644 --- a/doc/using-the-pandoc-api.md +++ b/doc/using-the-pandoc-api.md @@ -90,8 +90,14 @@ Some notes: Let's look at the types of `readMarkdown` and `writeRST`: ```haskell -readMarkdown :: PandocMonad m => ReaderOptions -> Text -> m Pandoc -writeRST :: PandocMonad m => WriterOptions -> Pandoc -> m Text +readMarkdown :: (PandocMonad m, ToSources a) + => ReaderOptions + -> a + -> m Pandoc +writeRST :: PandocMonad m + => WriterOptions + -> Pandoc + -> m Text ``` The `PandocMonad m =>` part is a typeclass constraint. @@ -155,6 +161,13 @@ Note that `PandocIO` is an instance of `MonadIO`, so you can use `liftIO` to perform arbitrary IO operations inside a pandoc conversion chain. +`readMarkdown` is polymorphic in its second argument, which +can be any type that is an instance of the `ToSources` +typeclass. You can use `Text`, as in the example above. +But you can also use `[(FilePath, Text)]`, if the input comes +from multiple files and you want to track source positions +accurately. + # Options The first argument of each reader or writer is for |