12
12
-- Portability : portable
13
13
--
14
14
-- MMark rendering machinery.
15
+ --
16
+ -- @since 0.0.8.0
15
17
module Text.MMark.Render
16
18
( render ,
19
+ applyBlockRender ,
20
+ defaultBlockRender ,
21
+ applyInlineRender ,
22
+ defaultInlineRender ,
23
+ newline ,
17
24
)
18
25
where
19
26
@@ -25,8 +32,8 @@ import Data.List.NonEmpty (NonEmpty (..))
25
32
import Data.List.NonEmpty qualified as NE
26
33
import Data.Text qualified as T
27
34
import Lucid
35
+ import Text.MMark.Internal.Type
28
36
import Text.MMark.Trans
29
- import Text.MMark.Type
30
37
import Text.MMark.Util
31
38
import Text.URI qualified as URI
32
39
@@ -50,13 +57,17 @@ render MMark {..} =
50
57
. fmap (applyInlineTrans extInlineTrans)
51
58
52
59
-- | Apply a 'Render' to a given @'Block' 'Html' ()@.
60
+ --
61
+ -- @since 0.0.8.0
53
62
applyBlockRender ::
54
63
Render (Block (Ois , Html () )) ->
55
64
Block (Ois , Html () ) ->
56
65
Html ()
57
66
applyBlockRender r = fix (runRender r . defaultBlockRender)
58
67
59
68
-- | The default 'Block' render.
69
+ --
70
+ -- @since 0.0.8.0
60
71
defaultBlockRender ::
61
72
-- | Rendering function to use to render sub-blocks
62
73
(Block (Ois , Html () ) -> Html () ) ->
@@ -131,10 +142,14 @@ defaultBlockRender blockRender = \case
131
142
CellAlignCenter -> [style_ " text-align:center" ]
132
143
133
144
-- | Apply a render to a given 'Inline'.
145
+ --
146
+ -- @since 0.0.8.0
134
147
applyInlineRender :: Render Inline -> Inline -> Html ()
135
148
applyInlineRender r = fix (runRender r . defaultInlineRender)
136
149
137
150
-- | The default render for 'Inline' elements.
151
+ --
152
+ -- @since 0.0.8.0
138
153
defaultInlineRender ::
139
154
-- | Rendering function to use to render sub-inlines
140
155
(Inline -> Html () ) ->
@@ -165,5 +180,7 @@ defaultInlineRender inlineRender = \case
165
180
in img_ (alt_ (asPlainText desc) : src_ (URI. render src) : title)
166
181
167
182
-- | HTML containing a newline.
183
+ --
184
+ -- @since 0.0.8.0
168
185
newline :: Html ()
169
186
newline = " \n "
0 commit comments