Markdown writer: ensure consistent padding for pipe tables.

Previously there was no space between text and bar in right-aligned
table cells.

This commit also ensures space on both sides for centered cells.

Closes #6240.
This commit is contained in:
John MacFarlane 2020-03-31 22:34:00 -07:00
parent 7df0710094
commit 247d8e8001

View file

@ -669,8 +669,8 @@ pipeTable :: PandocMonad m
pipeTable headless aligns rawHeaders rawRows = do
let sp = literal " "
let blockFor AlignLeft x y = lblock (x + 2) (sp <> y) <> lblock 0 empty
blockFor AlignCenter x y = cblock (x + 2) (sp <> y) <> lblock 0 empty
blockFor AlignRight x y = rblock (x + 2) (sp <> y) <> lblock 0 empty
blockFor AlignCenter x y = cblock (x + 2) (sp <> y <> sp) <> lblock 0 empty
blockFor AlignRight x y = rblock (x + 2) (y <> sp) <> lblock 0 empty
blockFor _ x y = lblock (x + 2) (sp <> y) <> lblock 0 empty
let widths = map (max 3 . maximum . map offset) $ transpose (rawHeaders : rawRows)
let torow cs = nowrap $ literal "|" <>