@@ -38,6 +38,7 @@ import Text.Pandoc.Parsing
3838import Text.Pandoc.Shared
3939import qualified Text.Pandoc.UTF8 as UTF8
4040import Data.Time.Format
41+import System.FilePath (takeDirectory)
4142
4243-- TODO:
4344-- [ ] .. parsed-literal
@@ -483,7 +484,8 @@ includeDirective top fields body = do
483484 Nothing -> id)
484485 let toStream t =
485486 toSources [(f, T.unlines . selectLines . T.lines $ t)]
486− insertIncludedFile parser toStream ["."] f startLine endLine
487+ currentDir <- takeDirectory . sourceName <$> getPosition
488+ insertIncludedFile parser toStream [currentDir] f startLine endLine
487489
488490--
489491-- list blocks