@@ -392,7 +392,11 @@ blockToMarkdown opts (CodeBlock attribs str) = return $
392 xs -> case maximum $ map length xs of
392 xs -> case maximum $ map length xs of
393 n | n < 3 -> "~~~~"
393 n | n < 3 -> "~~~~"
394 | otherwise -> replicate (n+1) '~'
394 | otherwise -> replicate (n+1) '~'
395− backticks = text "```"
395+ backticks = text $ case [ln | ln <- lines str, all (=='`') ln] of
397+ xs -> case maximum $ map length xs of
399+ | otherwise -> replicate (n+1) '`'
396 attrs = if isEnabled Ext_fenced_code_attributes opts
400 attrs = if isEnabled Ext_fenced_code_attributes opts
397 then nowrap $ " " <> attrsToMarkdown attribs
401 then nowrap $ " " <> attrsToMarkdown attribs
398 else case attribs of
402 else case attribs of