@@ -19,6 +19,7 @@ where
1919import Prelude
2020import Control.Monad.State
2121import qualified Data.Map as M
22+import Data.Char (toLower)
2223import Data.Maybe (catMaybes, fromMaybe)
2324import Text.Pandoc.Options
2425import Text.Pandoc.Definition
@@ -136,7 +137,7 @@ extractCells opts (Div (_id,classes,kvs) xs : bs)
136137 case consolidateAdjacentRawBlocks xs of
137138 [RawBlock (Format f) raw] -> do
138139 let format' =
139− case f of
140+ case map toLower f of
140141 "html" -> "text/html"
141142 "revealjs" -> "text/html"
142143 "latex" -> "text/latex"
@@ -146,8 +147,10 @@ extractCells opts (Div (_id,classes,kvs) xs : bs)
146147 (Cell{
147148 cellType = Raw
148149 , cellSource = Source $ breakLines $ T.pack raw
149− , cellMetadata = M.insert "format"
150− (Aeson.String $ T.pack format') mempty
150+ , cellMetadata = if format' == "ipynb" -- means no format given
151+ then mempty
152+ else M.insert "format"
153+ (Aeson.String $ T.pack format') mempty
151154 , cellAttachments = Nothing } :) <$> extractCells opts bs
152155 _ -> extractCells opts bs
153156extractCells opts (CodeBlock (_id,classes,kvs) raw : bs)