aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Extensions.hs4
-rw-r--r--src/Text/Pandoc/Readers/Ipynb.hs6
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index 0a33cf39e..0358c84f1 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -133,6 +133,7 @@ data Extension =
| Ext_raw_attribute -- ^ Allow explicit raw blocks/inlines
| Ext_raw_html -- ^ Allow raw HTML
| Ext_raw_tex -- ^ Allow raw TeX (other than math)
+ | Ext_raw_markdown -- ^ Parse markdown in ipynb as raw markdown
| Ext_shortcut_reference_links -- ^ Shortcut reference links
| Ext_simple_tables -- ^ Pandoc-style simple tables
| Ext_smart -- ^ "Smart" quotes, apostrophes, ellipses, dashes
@@ -442,7 +443,8 @@ getAllExtensions f = universalExtensions <> getAll f
getAll "markdown_mmd" = allMarkdownExtensions
getAll "markdown_github" = allMarkdownExtensions
getAll "markdown" = allMarkdownExtensions
- getAll "ipynb" = allMarkdownExtensions
+ getAll "ipynb" = allMarkdownExtensions <> extensionsFromList
+ [ Ext_raw_markdown ]
getAll "docx" = extensionsFromList
[ Ext_empty_paragraphs
, Ext_styles
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
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 15807123e..d0b50a8d6 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -483,10 +483,10 @@ blockToMarkdown' opts b@(RawBlock f str) = do
let renderEmpty = mempty <$ report (BlockNotRendered b)
case variant of
PlainText -> renderEmpty
- _ | isEnabled Ext_raw_attribute opts -> rawAttribBlock
- | f `elem` ["markdown", "markdown_github", "markdown_phpextra",
+ _ | f `elem` ["markdown", "markdown_github", "markdown_phpextra",
"markdown_mmd", "markdown_strict"] ->
return $ literal str <> literal "\n"
+ | isEnabled Ext_raw_attribute opts -> rawAttribBlock
| f `elem` ["html", "html5", "html4"] ->
case () of
_ | isEnabled Ext_markdown_attribute opts -> return $