@@ -1126,12 +1126,12 @@ multilineTableHeader headless = try $ do
11261126 then liftM (map (:[]) . tail .
11271127 splitStringByIndices (init indices)) $ lookAhead anyLine
11281128 else return $ transpose $ map
1129− (\ln -> tail $ splitStringByIndices (init indices) ln)
1129+ (tail . splitStringByIndices (init indices))
11301130 rawContent
11311131 let aligns = zipWith alignType rawHeadsList lengths
11321132 let rawHeads = if headless
11331133 then replicate (length dashes) ""
1134− else map unwords rawHeadsList
1134+ else map (unlines . map trim) rawHeadsList
11351135 heads <- fmap sequence $
11361136 mapM (parseFromString (mconcat <$> many plain)) $
11371137 map trim rawHeads
@@ -1188,7 +1188,7 @@ gridTableHeader headless = try $ do
11881188 -- RST does not have a notion of alignments
11891189 let rawHeads = if headless
11901190 then replicate (length dashes) ""
1191− else map unwords $ transpose
1191+ else map (unlines . map trim) $ transpose
11921192 $ map (gridTableSplitLine indices) rawContent
11931193 heads <- fmap sequence $ mapM (parseFromString parseBlocks . trim) rawHeads
11941194 return (heads, aligns, indices)