@@ -877,10 +877,11 @@ csvTableDirective top fields rawcsv = do
877877 (bs, _) <- fetchItem u
878878 return $ UTF8.toText bs
879879 Nothing -> return rawcsv
880− let res = parseCSV opts (case explicitHeader of
881− Just h -> h <> "\n" <> rawcsv'
882− Nothing -> rawcsv')
883− case res of
880+ let header' = case explicitHeader of
881+ Just h -> parseCSV defaultCSVOptions h
882+ Nothing -> Right []
883+ let res = parseCSV opts rawcsv'
884+ case (<>) <$> header' <*> res of
884885 Left e ->
885886 throwError $ PandocParsecError "csv table" e
886887 Right rawrows -> do