-- | Converts Pandoc to HTML. module Text.Pandoc.Writers.HTML ( writeHtml ) where import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Html ( stringToHtmlString ) import Text.Regex ( mkRegex ) import Numeric ( showHex ) import Char ( ord ) import List ( isPrefixOf ) -- | Convert Pandoc document to string in HTML format. writeHtml :: WriterOptions -> Pandoc -> String writeHtml options (Pandoc (Meta title authors date) blocks) = let titlePrefix = writerTitlePrefix options in let topTitle = if not (null titlePrefix) then [Str titlePrefix] ++ (if not (null title) then [Str " - "] ++ title else []) else title in let head = if (writerStandalone options) then htmlHeader options (Meta topTitle authors date) else "" titleBlocks = if (writerStandalone options) && (not (null title)) && (not (writerS5 options)) then [RawHtml "