diff --git a/src/Reflex/Dom/Pandoc/Document.hs b/src/Reflex/Dom/Pandoc/Document.hs index 660cdb3..6e3e789 100644 --- a/src/Reflex/Dom/Pandoc/Document.hs +++ b/src/Reflex/Dom/Pandoc/Document.hs @@ -1,10 +1,11 @@ {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} module Reflex.Dom.Pandoc.Document ( elPandocDoc , elPandocInlines + , elPandocHeading1 ) where import Control.Monad (forM_) @@ -24,6 +25,12 @@ import Reflex.Dom.Pandoc.Util (elPandocAttr, headerElement, renderAttr) elPandocDoc :: DomBuilder t m => Pandoc -> m () elPandocDoc (Pandoc _meta blocks) = mapM_ renderBlock blocks +-- | Render the first level of heading +elPandocHeading1 :: DomBuilder t m => Pandoc -> m () +elPandocHeading1 (Pandoc _meta blocks) = forM_ blocks $ \case + Header 1 _ xs -> mapM_ renderInline xs + _ -> blank + -- | Render list of Pandoc inlines -- -- Useful when dealing with metadata values