diff options
author | Kolen Cheung <christian.kolen@gmail.com> | 2021-09-10 18:35:22 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-09-10 21:11:28 -0700 |
commit | c66cedaa7137f1f731677b13e4b883be02573b9e (patch) | |
tree | acb54ab8ec5e3acaa8c6e245d08486307a37e61d | |
parent | 17092454c5ba0e16f26b8787e6a9b9c8a35b7b67 (diff) | |
download | pandoc-c66cedaa7137f1f731677b13e4b883be02573b9e.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Writers/Ipynb.hs | 4 |
1 files changed, 2 insertions, 2 deletions
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 |