@@ -150,6 +150,19 @@ strNormalize (Str "" : ils) = strNormalize ils
150150strNormalize ((Str s) : (Str s') : l) = strNormalize ((Str (s++s')) : l)
151151strNormalize (il:ils) = il : (strNormalize ils)
152152
153+blockNormalize :: Block -> Block
154+blockNormalize (Plain (Space : ils)) = blockNormalize (Plain ils)
155+blockNormalize (Plain ils) = Plain $ strNormalize ils
156+blockNormalize (Para (Space : ils)) = blockNormalize (Para ils)
157+blockNormalize (Para ils) = Para $ strNormalize ils
158+blockNormalize (Header n attr (Space : ils)) =
159+ blockNormalize $ Header n attr ils
160+blockNormalize (Table (Space : ils) align width hdr cells) =
161+ blockNormalize $ Table ils align width hdr cells
162+blockNormalize (Table ils align width hdr cells) =
163+ Table (strNormalize ils) align width hdr cells
164+blockNormalize blk = blk
165+
153166runToInlines :: ReaderOptions -> Docx -> Run -> [Inline]
154167runToInlines _ _ (Run rs runElems)
155168 | isJust (rStyle rs) && (fromJust (rStyle rs)) `elem` codeSpans =
@@ -296,7 +309,7 @@ makeImagesSelfContained _ inline = inline
296309bodyToBlocks :: ReaderOptions -> Docx -> Body -> [Block]
297310bodyToBlocks opts docx (Body bps) =
298311 bottomUp removeEmptyPars $
299− bottomUp strNormalize $
312+ bottomUp blockNormalize $
300313 bottomUp spanRemove $
301314 bottomUp divRemove $
302315 map (makeHeaderAnchors) $