@@ -111,9 +111,12 @@ blockToNodes opts (Para xs) ns =
111111blockToNodes opts (LineBlock lns) ns = blockToNodes opts (linesToPara lns) ns
112112blockToNodes _ (CodeBlock (_,classes,_) xs) ns = return
113113 (node (CODE_BLOCK (T.pack (unwords classes)) (T.pack xs)) [] : ns)
114−blockToNodes _ (RawBlock fmt xs) ns
115− | fmt == Format "html" = return (node (HTML_BLOCK (T.pack xs)) [] : ns)
116− | otherwise = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
114+blockToNodes opts (RawBlock fmt xs) ns
115+ | fmt == Format "html" && isEnabled Ext_raw_html opts
116+ = return (node (HTML_BLOCK (T.pack xs)) [] : ns)
117+ | fmt == Format "latex" || fmt == Format "tex" && isEnabled Ext_raw_tex opts
118+ = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)
119+ | otherwise = return ns
117120blockToNodes opts (BlockQuote bs) ns = do
118121 nodes <- blocksToNodes opts bs
119122 return (node BLOCK_QUOTE nodes : ns)
@@ -263,9 +266,12 @@ inlineToNodes opts (Image alt ils (url,'f':'i':'g':':':tit)) =
263266 inlineToNodes opts (Image alt ils (url,tit))
264267inlineToNodes opts (Image _ ils (url,tit)) =
265268 (node (IMAGE (T.pack url) (T.pack tit)) (inlinesToNodes opts ils) :)
266−inlineToNodes _ (RawInline fmt xs)
267− | fmt == Format "html" = (node (HTML_INLINE (T.pack xs)) [] :)
268− | otherwise = (node (CUSTOM_INLINE (T.pack xs) T.empty) [] :)
269+inlineToNodes opts (RawInline fmt xs)
270+ | fmt == Format "html" && isEnabled Ext_raw_html opts
271+ = (node (HTML_INLINE (T.pack xs)) [] :)
272+ | (fmt == Format "latex" || fmt == Format "tex") && isEnabled Ext_raw_tex opts
273+ = (node (CUSTOM_INLINE (T.pack xs) T.empty) [] :)
274+ | otherwise = id
269275inlineToNodes opts (Quoted qt ils) =
270276 ((node (TEXT start) [] :
271277 inlinesToNodes opts ils ++ [node (TEXT end) []]) ++)