@@ -381,13 +381,11 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str)
381 isEnabled Ext_literate_haskell opts =
381 isEnabled Ext_literate_haskell opts =
382 return $ prefixed "> " (text str) <> blankline
382 return $ prefixed "> " (text str) <> blankline
383blockToMarkdown opts (CodeBlock attribs str) = return $
383blockToMarkdown opts (CodeBlock attribs str) = return $
384− case attribs of
384+ case attribs == nullAttr of
385+ False | isEnabled Ext_backtick_code_blocks opts ->
386+ backticks <> attrs <> cr <> text str <> cr <> backticks <> blankline
385− x | x /= nullAttr && isEnabled Ext_fenced_code_blocks opts ->
387+ | isEnabled Ext_fenced_code_blocks opts ->
386− tildes <> " " <> attrs <> cr <> text str <>
388+ tildes <> attrs <> cr <> text str <> cr <> tildes <> blankline
387− cr <> tildes <> blankline
388− (_,(cls:_),_) | isEnabled Ext_backtick_code_blocks opts ->
389− backticks <> " " <> text cls <> cr <> text str <>
390− cr <> backticks <> blankline
391 _ -> nest (writerTabStop opts) (text str) <> blankline
389 _ -> nest (writerTabStop opts) (text str) <> blankline
392 where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of
390 where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of
393 [] -> "~~~~"
391 [] -> "~~~~"
@@ -396,8 +394,10 @@ blockToMarkdown opts (CodeBlock attribs str) = return $
396 | otherwise -> replicate (n+1) '~'
394 | otherwise -> replicate (n+1) '~'
397 backticks = text "```"
395 backticks = text "```"
398 attrs = if isEnabled Ext_fenced_code_attributes opts
396 attrs = if isEnabled Ext_fenced_code_attributes opts
399− then nowrap $ attrsToMarkdown attribs
397+ then nowrap $ " " <> attrsToMarkdown attribs
398+ else case attribs of
399+ (_,[cls],_) -> " " <> text cls
400− else empty
400+ _ -> empty
401blockToMarkdown opts (BlockQuote blocks) = do
401blockToMarkdown opts (BlockQuote blocks) = do
402 st <- get
402 st <- get
403 -- if we're writing literate haskell, put a space before the bird tracks
403 -- if we're writing literate haskell, put a space before the bird tracks