@@ -45,7 +45,9 @@ docHToBlocks d' =
4545 DocString _ -> inlineFallback
4646 DocParagraph (DocHeader h) -> docHToBlocks (DocHeader h)
4747 DocParagraph (DocAName h) -> B.plain $ docHToInlines False $ DocAName h
48− DocParagraph ils -> B.para $ docHToInlines False ils
48+ DocParagraph x -> let (ils, rest) = getInlines x
49+ in (B.para $ docHToInlines False ils)
50+ <> docHToBlocks rest
4951 DocIdentifier _ -> inlineFallback
5052 DocIdentifierUnchecked _ -> inlineFallback
5153 DocModule s -> B.plain $ docHToInlines False $ DocModule s
@@ -60,7 +62,7 @@ docHToBlocks d' =
6062 DocDefList items -> B.definitionList (map (\(d,t) ->
6163 (docHToInlines False d,
6264 [consolidatePlains $ docHToBlocks t])) items)
63− DocCodeBlock (DocString s) -> B.codeBlockWith ("",["haskell"],[]) s
65+ DocCodeBlock (DocString s) -> B.codeBlockWith ("",[],[]) s
6466 DocCodeBlock d -> B.para $ docHToInlines True d
6567 DocHyperlink _ -> inlineFallback
6668 DocPic _ -> inlineFallback
@@ -92,9 +94,9 @@ docHToInlines isCode d' =
9294 $ map B.code $ splitBy (=='\n') s
9395 | otherwise -> B.text s
9496 DocParagraph _ -> mempty
95− DocIdentifier (_,s,_) -> B.codeWith ("",["haskell"],[]) s
96− DocIdentifierUnchecked s -> B.codeWith ("",["haskell"],[]) s
97− DocModule s -> B.codeWith ("",["haskell"],[]) s
97+ DocIdentifier (_,s,_) -> B.codeWith ("",["haskell","identifier"],[]) s
98+ DocIdentifierUnchecked s -> B.codeWith ("",["haskell","identifier"],[]) s
99+ DocModule s -> B.codeWith ("",["haskell","module"],[]) s
98100 DocWarning _ -> mempty -- TODO
99101 DocEmphasis d -> B.emph (docHToInlines isCode d)
100102 DocMonospaced (DocString s) -> B.code s
@@ -113,6 +115,40 @@ docHToInlines isCode d' =
113115 DocProperty _ -> mempty
114116 DocExamples _ -> mempty
115117
118+getInlines :: DocH String Identifier -> (DocH String Identifier, DocH String Identifier)
119+getInlines (DocAppend x y) = if isInline x
120+ then let (a, b) = getInlines y
121+ in (DocAppend x a, b)
122+ else (DocEmpty, DocAppend x y)
123+getInlines x = if isInline x
124+ then (x, DocEmpty)
125+ else (DocEmpty, x)
126+
127+isInline :: DocH String Identifier -> Bool
128+isInline d' =
129+ case d' of
130+ DocEmpty -> True
131+ DocAppend d1 _ -> isInline d1
132+ DocString _ -> True
133+ DocParagraph _ -> False
134+ DocIdentifier _ -> True
135+ DocIdentifierUnchecked _ -> True
136+ DocModule _ -> True
137+ DocWarning _ -> True
138+ DocEmphasis _ -> True
139+ DocMonospaced _ -> True
140+ DocBold _ -> True
141+ DocHeader _ -> False
142+ DocUnorderedList _ -> False
143+ DocOrderedList _ -> False
144+ DocDefList _ -> False
145+ DocCodeBlock _ -> False
146+ DocHyperlink _ -> True
147+ DocPic _ -> True
148+ DocAName _ -> True
149+ DocProperty _ -> False
150+ DocExamples _ -> False
151+
116152-- | Create an 'Example', stripping superfluous characters as appropriate
117153makeExample :: String -> String -> [String] -> Blocks
118154makeExample prompt expression result =