diff --git a/Hakyll/Web/Agda.hs b/Hakyll/Web/Agda.hs
--- a/Hakyll/Web/Agda.hs
+++ b/Hakyll/Web/Agda.hs
@@ -9,26 +9,10 @@
     , pandocAgdaCompiler
     ) where
 
-import           Control.Applicative
-import           Data.Char
-import           Data.Function
-import           Data.List
-import           Data.Maybe
-import           Data.Monoid
-
-import           Control.Monad.Error (catchError, throwError)
-import           Control.Monad.IO.Class (liftIO)
-import           Control.Monad.State (get)
-import qualified Data.IntMap as IntMap
-import           System.Directory hiding (findFile)
-import           System.Exit (exitFailure)
-import           System.FilePath
-import           Text.XHtml.Strict
-
+import           Agda.Interaction.FindFile (findFile)
 import           Agda.Interaction.Highlighting.Precise
 import qualified Agda.Interaction.Imports as Imp
 import           Agda.Interaction.Options
-import           Agda.Interaction.FindFile (findFile)
 import           Agda.Syntax.Abstract.Name (toTopLevelModuleName)
 import           Agda.Syntax.Common
 import           Agda.Syntax.Concrete.Name (TopLevelModuleName)
@@ -37,12 +21,22 @@
 import qualified Agda.TypeChecking.Monad as TCM
 import           Agda.Utils.FileName
 import qualified Agda.Utils.IO.UTF8 as UTF8
-import           Agda.Utils.Lens (use)
+import           Control.Monad.Except (catchError, throwError)
+import           Control.Monad.IO.Class (liftIO)
+import           Data.Char (isSpace)
+import           Data.Function (on)
+import qualified Data.IntMap as IntMap
+import           Data.List (groupBy, isInfixOf, isPrefixOf, tails)
+import           Data.Maybe (fromMaybe)
 import           Hakyll.Core.Compiler
 import           Hakyll.Core.Identifier
 import           Hakyll.Core.Item
 import           Hakyll.Web.Pandoc
-import           Text.Pandoc
+import           System.Directory (getCurrentDirectory, setCurrentDirectory, canonicalizePath, setCurrentDirectory)
+import           System.Exit (exitFailure)
+import           System.FilePath (dropFileName, splitExtension)
+import           Text.Pandoc (readMarkdown, ReaderOptions, WriterOptions)
+import           Text.XHtml.Strict
 
 checkFile :: AbsolutePath -> TCM TopLevelModuleName
 checkFile file = do
@@ -195,7 +189,9 @@
              setCurrentDirectory (dropFileName abfp)
              s <- markdownAgda aopt "Agda" abfp
              let i' = i {itemBody = s}
-             return (writePandocWith wopt (readMarkdown ropt <$> i'))
+             case traverse (readMarkdown ropt) i' of
+               Left err -> fail $ "pandocAgdaCompilerWith: Pandoc failed with error " ++ show err
+               Right i'' -> return $ writePandocWith wopt i''
       else pandocCompilerWith ropt wopt
   where
     cacheName = "LiterateAgda.pandocAgdaCompilerWith"
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 2013-2015, Francesco Mazzoli
+ 
+All rights reserved.
+ 
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+ 
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+ 
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+ 
+    * Neither the name of Jasper Van der Jeugt nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+ 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/hakyll-agda.cabal b/hakyll-agda.cabal
--- a/hakyll-agda.cabal
+++ b/hakyll-agda.cabal
@@ -1,10 +1,11 @@
 Cabal-version:      >= 1.6
 Name:               hakyll-agda
-Version:            0.1.9
+Version:            0.1.10
 Author:             Francesco Mazzoli (f@mazzo.li)
 Maintainer:         Francesco Mazzoli (f@mazzo.li)
 Build-Type:         Simple
 License:            BSD3
+License-File:       LICENSE
 Build-Type:         Simple
 Category:           Web
 Synopsis:           Wrapper to integrate literate Agda files with Hakyll
@@ -20,15 +21,15 @@
     location: git://github.com/bitonic/hakyll-agda.git
 
 Library
-    Build-Depends:    base         >= 3 && < 5,
-                      Agda         >= 2.4.2.2,
-                      containers   >= 0.3,
-                      directory    >= 1,
-                      filepath     >= 1,
-                      hakyll       >= 4.3,
-                      mtl          >= 2,
-                      pandoc       >= 1.10,
-                      transformers >= 0.3,
-                      xhtml        >= 3000.2
+    Build-Depends:    base         >= 3 && < 5
+                    , Agda         == 2.4.2.3
+                    , containers
+                    , directory
+                    , filepath
+                    , hakyll       == 4.7.2.0
+                    , mtl
+                    , pandoc
+                    , transformers
+                    , xhtml
     GHC-Options:      -Wall
     Exposed-Modules:  Hakyll.Web.Agda
