@@ -28,6 +28,13 @@ import System.FilePath.Posix (takeExtension)
28
28
import qualified Data.ByteString.Lazy as BS (ByteString , toStrict )
29
29
import qualified Text.XHtml.Strict as XHtml
30
30
31
+ -- Set up doctest to deal with bytestring literals.
32
+ -- Need to import a suitable @instance IsString@ for @ByteString@.
33
+
34
+ -- $setup
35
+ -- >>> :set -XOverloadedStrings
36
+ -- >>> import Data.ByteString.Lazy.Char8 ()
37
+
31
38
-- HHtml wraps Html, and mostly behaves the same, except that
32
39
-- relative links in images and urls have "src/" prepended.
33
40
newtype HHtml a = HHtml { unHHtml :: Html a }
@@ -104,13 +111,27 @@ adjustRelativeLink url
104
111
| otherwise = url
105
112
106
113
-- | Render markdown to HTML.
114
+ --
115
+ -- >>> renderMarkdown "test" "Please send bug reports to [email protected] ."
116
+ -- <p>Please send bug reports to <a href="mailto:[email protected] ">[email protected] </a>.</p>
117
+ -- <BLANKLINE>
118
+ --
119
+ -- >>> renderMarkdown "test" "Published to http://hackage.haskell.org/foo3/bar."
120
+ -- <p>Published to <a href="http://hackage.haskell.org/foo3/bar">http://hackage.haskell.org/foo3/bar</a>.</p>
121
+ -- <BLANKLINE>
122
+ --
107
123
renderMarkdown
108
124
:: String -- ^ Name or path of input.
109
125
-> BS. ByteString -- ^ Commonmark text input.
110
126
-> XHtml. Html -- ^ Rendered HTML.
111
127
renderMarkdown = renderMarkdown' (renderHtml :: Html () -> TL. Text )
112
128
113
129
-- | Render markdown to HTML, prefixing relative links with @src/@.
130
+ --
131
+ -- >>> renderMarkdownRel "test" "See [world file](world.txt)."
132
+ -- <p>See <a href="src/world.txt">world file</a>.</p>
133
+ -- <BLANKLINE>
134
+ --
114
135
renderMarkdownRel
115
136
:: String -- ^ Name or path of input.
116
137
-> BS. ByteString -- ^ Commonmark text input.
0 commit comments