@@ -77,7 +77,7 @@ import System.Posix.Terminal (queryTerminal)
7777import System.Posix.IO (stdOutput)
7878#endif
7979import Control.Monad.Trans
80−import Text.Pandoc.Class (withMediaBag, PandocIO)
80+import Text.Pandoc.Class (withMediaBag, PandocIO, withWarningsToStderr)
8181
8282type Transform = Pandoc -> Pandoc
8383
@@ -1414,10 +1414,14 @@ convertWithOpts opts args = do
14141414 srcs <- convertTabs . intercalate "\n" <$> readSources sources'
14151415 doc <- handleIncludes' srcs
14161416 case doc of
1417− Right doc' -> runIOorExplode $ withMediaBag $ r readerOpts doc'
1417+ Right doc' -> runIOorExplode $ withMediaBag
1418+ $ withWarningsToStderr
1419+ $ r readerOpts doc'
14181420 Left e -> error $ show e
14191421 ByteStringReader r -> readFiles sources' >>=
1420− (\bs -> runIOorExplode $ withMediaBag $ r readerOpts bs)
1422+ (\bs -> runIOorExplode $ withMediaBag
1423+ $ withWarningsToStderr
1424+ $ r readerOpts bs)
14211425
14221426 -- We parse first if (1) fileScope is set, (2), it's a binary
14231427 -- reader, or (3) we're reading JSON. This is easier to do of an AND
@@ -1489,7 +1493,9 @@ convertWithOpts opts args = do
14891493
14901494 case writer of
14911495 -- StringWriter f -> f writerOptions doc' >>= writerFn outputFile
1492− ByteStringWriter f -> (runIOorExplode $ f writerOptions doc') >>= writeFnBinary outputFile
1496+ ByteStringWriter f -> (runIOorExplode $ withWarningsToStderr
1497+ $ f writerOptions doc')
1498+ >>= writeFnBinary outputFile
14931499 StringWriter f
14941500 | pdfOutput -> do
14951501 -- make sure writer is latex or beamer or context or html5
@@ -1523,5 +1529,6 @@ convertWithOpts opts args = do
15231529 handleEntities = if htmlFormat && ascii
15241530 then toEntities
15251531 else id
1526− output <- runIOorExplode $ f writerOptions doc'
1532+ output <- runIOorExplode $ withWarningsToStderr
1533+ $ f writerOptions doc'
15271534 selfcontain (output ++ ['\n' | not standalone']) >>= writerFn outputFile . handleEntities