git.iko.soy/typeable/pandoc
on master help sign in
CommonMark writer: prefer pipe tables to HTML tables...

...even if it means losing relative column width information. See #3734.

commit8f65590ce9fc84452b22a3914190a8d9bc4ceda2 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 13 Aug 2017, 10:43 (9 years ago) parent506866e
2 files changed+13−3
src/Text/Pandoc/Writers/CommonMark.hs+2−3 test/command/3734.md+11
src/Text/Pandoc/Writers/CommonMark.hs+2−3
@@ -148,7 +148,7 @@ blockToNodes opts (DefinitionList items) ns =
148148 Plain (term ++ [LineBreak] ++ xs) : ys ++ concat zs
149149 dlToBullet (term, xs) =
150150 Para term : concat xs
151−blockToNodes opts t@(Table capt aligns widths headers rows) ns = do
151+blockToNodes opts t@(Table capt aligns _widths headers rows) ns = do
152152 let allcells = concat (headers:rows)
153153 let isLineBreak LineBreak = Any True
154154 isLineBreak _ = Any False
@@ -156,8 +156,7 @@ blockToNodes opts t@(Table capt aligns widths headers rows) ns = do
156156 isPlainOrPara [Plain _] = True
157157 isPlainOrPara [] = True
158158 isPlainOrPara _ = False
159− let isSimple = all (==0) widths &&
160− all isPlainOrPara allcells &&
159+ let isSimple = all isPlainOrPara allcells &&
161160 not ( getAny (query isLineBreak allcells) )
162161 if isEnabled Ext_pipe_tables opts && isSimple
163162 then do
test/command/3734.md+11
@@ -37,3 +37,14 @@
3737|--------------|-------|--------------------------------------------------------------------------|
3838| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
3939```
40+
41+```
42+% pandoc -t gfm
43+| aaaaaaaaaaaa | bbbbb | ccccccccccc |
44+|--------------|-------|--------------------------------------------------------------------------|
45+| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
46+^D
47+| aaaaaaaaaaaa | bbbbb | ccccccccccc |
48+| ------------ | ----- | ------------------------------------------------------------------------ |
49+| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
50+```