From c66cedaa7137f1f731677b13e4b883be02573b9e Mon Sep 17 00:00:00 2001 From: Kolen Cheung Date: Fri, 10 Sep 2021 18:35:22 -0700 Subject: fix!(ipynb writer): improve round trip identity for raw cell output BREAKING CHANGE: The Jupyter ecosystem, including nbconvert, lab and notebook, deviated from their own spec in nbformat, where they used the key `raw_mimetype` instead of `format`. Moreover, the mime-type of rst used in Jupyter deviated from that suggested by https://docutils.sourceforge.io/FAQ.html and is defined as `text/restructuredtext` when chosen from "Raw NBConvert Format" in Jupyter. So while this is backward-compatible, it should matches the real world usage better, hence improving the round-trip "identity" in raw-cell. See #229, jupyter/nbformat#229. --- src/Text/Pandoc/Writers/Ipynb.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Ipynb.hs b/src/Text/Pandoc/Writers/Ipynb.hs index 3c3bdb3a5..30ef100ad 100644 --- a/src/Text/Pandoc/Writers/Ipynb.hs +++ b/src/Text/Pandoc/Writers/Ipynb.hs @@ -147,7 +147,7 @@ extractCells opts (Div (_id,classes,kvs) xs : bs) "revealjs" -> "text/html" "latex" -> "text/latex" "markdown" -> "text/markdown" - "rst" -> "text/x-rst" + "rst" -> "text/restructuredtext" "asciidoc" -> "text/asciidoc" _ -> f (Ipynb.Cell{ @@ -155,7 +155,7 @@ extractCells opts (Div (_id,classes,kvs) xs : bs) , cellSource = Source $ breakLines raw , cellMetadata = if format' == "ipynb" -- means no format given then mempty - else M.insert "format" + else M.insert "raw_mimetype" (Aeson.String format') mempty , cellAttachments = Nothing } :) <$> extractCells opts bs _ -> extractCells opts bs -- cgit v1.2.3