aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Extensions.hs16
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs18
2 files changed, 23 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index 430d13401..75c44dba8 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -339,7 +339,17 @@ getDefaultExtensions "muse" = extensionsFromList
[Ext_amuse,
Ext_auto_identifiers]
getDefaultExtensions "plain" = plainExtensions
-getDefaultExtensions "gfm" = githubMarkdownExtensions
+getDefaultExtensions "gfm" = extensionsFromList
+ [ Ext_pipe_tables
+ , Ext_raw_html
+ , Ext_native_divs
+ , Ext_auto_identifiers
+ , Ext_gfm_auto_identifiers
+ , Ext_autolink_bare_uris
+ , Ext_strikeout
+ , Ext_task_lists
+ , Ext_emoji
+ ]
getDefaultExtensions "commonmark" = extensionsFromList
[Ext_raw_html]
getDefaultExtensions "commonmark_x" = extensionsFromList
@@ -364,9 +374,7 @@ getDefaultExtensions "commonmark_x" = extensionsFromList
, Ext_raw_attribute
, Ext_implicit_header_references
, Ext_attributes
- , Ext_fenced_code_blocks
, Ext_fenced_code_attributes
- , Ext_backtick_code_blocks
]
getDefaultExtensions "org" = extensionsFromList
[Ext_citations,
@@ -489,9 +497,7 @@ getAllExtensions f = universalExtensions <> getAll f
, Ext_raw_attribute
, Ext_implicit_header_references
, Ext_attributes
- , Ext_fenced_code_blocks
, Ext_fenced_code_attributes
- , Ext_backtick_code_blocks
]
getAll "commonmark_x" = getAll "commonmark"
getAll "org" = autoIdExtensions <>
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index e41273b27..3e50704ca 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -561,9 +561,12 @@ blockToMarkdown' opts (CodeBlock (_,classes,_) str)
| "haskell" `elem` classes && "literate" `elem` classes &&
isEnabled Ext_literate_haskell opts =
return $ prefixed "> " (literal str) <> blankline
-blockToMarkdown' opts (CodeBlock attribs str) = return $
- case attribs == nullAttr of
- False | isEnabled Ext_backtick_code_blocks opts ->
+blockToMarkdown' opts (CodeBlock attribs str) = do
+ variant <- asks envVariant
+ return $
+ case attribs == nullAttr of
+ False | variant == Commonmark ||
+ isEnabled Ext_backtick_code_blocks opts ->
backticks <> attrs <> cr <> literal str <> cr <> backticks <> blankline
| isEnabled Ext_fenced_code_blocks opts ->
tildes <> attrs <> cr <> literal str <> cr <> tildes <> blankline
@@ -856,9 +859,12 @@ blockListToMarkdown opts blocks = do
-- b) change Plain to Para unless it's followed by a RawBlock
-- or has a list as its parent (#3487)
let fixBlocks (b : CodeBlock attr x : rest)
- | (not (isEnabled Ext_fenced_code_blocks opts) || attr == nullAttr)
- && isListBlock b = b : commentSep : CodeBlock attr x :
- fixBlocks rest
+ | (not (variant == Commonmark ||
+ isEnabled Ext_backtick_code_blocks opts ||
+ isEnabled Ext_fenced_code_blocks opts) ||
+ attr == nullAttr)
+ && isListBlock b
+ = b : commentSep : CodeBlock attr x : fixBlocks rest
fixBlocks (b1@(BulletList _) : b2@(BulletList _) : bs) =
b1 : commentSep : fixBlocks (b2:bs)
fixBlocks (b1@(OrderedList _ _) : b2@(OrderedList _ _) : bs) =