mirror of
https://github.com/srid/rib.git
synced 2024-11-30 03:45:00 +03:00
Add elPandocHeadling1
Useful to extract the title out of the document especially if none is specified in Metadata.
This commit is contained in:
parent
f97e76e72e
commit
6e5fddb2c9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user