sergiocorreia/panflute

Support for Pandoc 3.2.x and Pandoc API 1.23.1

Opened this issue · 0 comments

Starting with Pandoc 3.1.6.1, the compatible version of the Pandoc API (on Hackage: pandoc-types has changed to 1.23.0.1 and later to 1.23.1 (latest).

It would be great if you (or somebody else via a PR) could update Panflute so that it becomes usable with Pandoc 3.2!

Your work is very much appreciated, btw!

As my small contribution: I looked into what changed in pandoc-types from 1.23.0: Besides updating the GHC, CI/CD components, and allowing bytestring 0.12, the only changes that may affect Panflute are IMHO these two:

jgm/pandoc-types@1d0e8b2

src/Text/Pandoc/JSON.hs

instance (Walkable [a] Pandoc, MonadIO m) => ToJSONFilter m (a -> [a]) where
  toJSONFilter f = liftIO $ BL.getContents >>=
    BL.putStr . encode . (walk (concatMap f) :: Pandoc -> Pandoc) .
    either error id .
    eitherDecode'

src/Text/Pandoc/JSON.hs

- instance (Walkable a Pandoc) => ToJSONFilter IO (a -> a) where
-  toJSONFilter f = BL.getContents >>=
+ instance (Walkable a Pandoc, MonadIO m) => ToJSONFilter m (a -> a) where
+  toJSONFilter f = liftIO $ BL.getContents >>=
+    BL.putStr . encode . (walk f :: Pandoc -> Pandoc) . either error id .
+    eitherDecode'

jgm/pandoc-types@01b2b86

The snippet from the changelog is below.

[1.23.1]

  • Restore toJSONFilter instance for pure a -> [a].
    This went missing after my ill-considered revision to #105,
    commit 183af9d9f1066be974ac55fd23a4c985999d3ce8 . See jgm/pandoc#8976.

  • Generalize ToJSONFilter instance. Previously a pure function a -> a
    could only be promoted to a filter in IO. Now we allow it to work with
    any instance of MonadIO. (This adds to #105.)

  • Allow bytestring 0.12.

[1.23.0.1]

  • Allow aeson 2.2.

  • Remove dependency on string-qq (recbecca skinner).