Skip to content

Commit

Permalink
Markdown writer: ensure consistent padding for pipe tables.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jgm committed Apr 1, 2020
1 parent 7df0710 commit 247d8e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Text/Pandoc/Writers/Markdown.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 "|" <>
Expand Down

0 comments on commit 247d8e8

Please sign in to comment.