aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Ipynb.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-07-23 17:47:02 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-07-23 17:47:02 -0700
commit48fb6d947df96e8e1f339b2916740f3e216f8908 (patch)
tree2eb75a84bd442e93012e4e43fe9a8ee18382feff /src/Text/Pandoc/Readers/Ipynb.hs
parentac1f45c5531ae3af3bba490898ade28460afaa9e (diff)
downloadpandoc-48fb6d947df96e8e1f339b2916740f3e216f8908.tar.gz
Add `raw_markdown` extension affecting `ipynb` reader.
Specifying `-f ipynb+raw_markdown` will cause Markdown cells to be represented as raw Markdown blocks, instead of being parsed. This is not what you want when going from `ipynb` to other formats, but it may be useful when going from `ipynb` to Markdown or to `ipynb`, to avoid semantically insignificant changes in the contents of the Markdown cells that might otherwise be introduced. Closes #5408.
Diffstat (limited to 'src/Text/Pandoc/Readers/Ipynb.hs')
-rw-r--r--src/Text/Pandoc/Readers/Ipynb.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Ipynb.hs b/src/Text/Pandoc/Readers/Ipynb.hs
index a245bdad3..a866e6ec3 100644
--- a/src/Text/Pandoc/Readers/Ipynb.hs
+++ b/src/Text/Pandoc/Readers/Ipynb.hs
@@ -78,7 +78,11 @@ cellToBlocks opts lang c = do
mapM_ addAttachment attachments
case cellType c of
Ipynb.Markdown -> do
- Pandoc _ bs <- walk fixImage <$> readMarkdown opts source
+ bs <- if isEnabled Ext_raw_markdown opts
+ then return [RawBlock (Format "markdown") source]
+ else do
+ Pandoc _ bs <- walk fixImage <$> readMarkdown opts source
+ return bs
return $ B.divWith ("",["cell","markdown"],kvs)
$ B.fromList bs
Ipynb.Heading lev -> do