git.iko.soy/typeable/pandoc
on master help sign in
CommonMark writer: prefer pipe tables to HTML tables...
8f65590John MacFarlane
src/Text/Pandoc/Writers/CommonMark.hs+2−3
@@ -148,7 +148,7 @@ blockToNodes opts (DefinitionList items) ns =
148 Plain (term ++ [LineBreak] ++ xs) : ys ++ concat zs
148 Plain (term ++ [LineBreak] ++ xs) : ys ++ concat zs
149 dlToBullet (term, xs) =
149 dlToBullet (term, xs) =
150 Para term : concat xs
150 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
152 let allcells = concat (headers:rows)
152 let allcells = concat (headers:rows)
153 let isLineBreak LineBreak = Any True
153 let isLineBreak LineBreak = Any True
154 isLineBreak _ = Any False
154 isLineBreak _ = Any False
@@ -156,8 +156,7 @@ blockToNodes opts t@(Table capt aligns widths headers rows) ns = do
156 isPlainOrPara [Plain _] = True
156 isPlainOrPara [Plain _] = True
157 isPlainOrPara [] = True
157 isPlainOrPara [] = True
158 isPlainOrPara _ = False
158 isPlainOrPara _ = False
159− let isSimple = all (==0) widths &&
160− all isPlainOrPara allcells &&
159+ let isSimple = all isPlainOrPara allcells &&
161 not ( getAny (query isLineBreak allcells) )
160 not ( getAny (query isLineBreak allcells) )
162 if isEnabled Ext_pipe_tables opts && isSimple
161 if isEnabled Ext_pipe_tables opts && isSimple
163 then do
162 then do
test/command/3734.md+11
@@ -37,3 +37,14 @@
37|--------------|-------|--------------------------------------------------------------------------|
37|--------------|-------|--------------------------------------------------------------------------|
38| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
38| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
39```
39```
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+```