git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: prefer pipe_tables to raw html...

...even when we must lose width information. All in all this seems to be people's preferred behavior, even though it is slightly lossier. Closes #2608. Closes #4497.

commit7c2dd0359b8ece3df91af81338274008c0740a69 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 11 Oct 2019, 09:46 (7 years ago) parent34e6464
2 files changed+6−24
src/Text/Pandoc/Writers/Markdown.hs+3−3 test/command/3734.md+3−21
src/Text/Pandoc/Writers/Markdown.hs+3−3
@@ -628,15 +628,15 @@ blockToMarkdown' opts t@(Table caption aligns widths headers rows) = do
628628 writerColumns opts >= 8 * numcols -> (id,) <$>
629629 gridTable opts blockListToMarkdown
630630 (all null headers) aligns' widths' headers rows
631− | isEnabled Ext_raw_html opts -> fmap (id,) $
632− (text . T.unpack) <$>
633− (writeHtml5String opts{ writerTemplate = Nothing } $ Pandoc nullMeta [t])
634631 | hasSimpleCells &&
635632 isEnabled Ext_pipe_tables opts -> do
636633 rawHeaders <- padRow <$> mapM (blockListToMarkdown opts) headers
637634 rawRows <- mapM (fmap padRow . mapM (blockListToMarkdown opts))
638635 rows
639636 (id,) <$> pipeTable (all null headers) aligns' rawHeaders rawRows
637+ | isEnabled Ext_raw_html opts -> fmap (id,) $
638+ (text . T.unpack) <$>
639+ (writeHtml5String opts{ writerTemplate = Nothing } $ Pandoc nullMeta [t])
640640 | otherwise -> return $ (id, text "[TABLE]")
641641 return $ nst (tbl $$ caption'') $$ blankline
642642blockToMarkdown' opts (BulletList items) = do
test/command/3734.md+3−21
@@ -4,27 +4,9 @@
44|--------------|-------|--------------------------------------------------------------------------|
55| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
66^D
7−<table>
8−<colgroup>
9−<col style="width: 14%" />
10−<col style="width: 7%" />
11−<col style="width: 77%" />
12−</colgroup>
13−<thead>
14−<tr class="header">
15−<th>aaaaaaaaaaaa</th>
16−<th>bbbbb</th>
17−<th>ccccccccccc</th>
18−</tr>
19−</thead>
20−<tbody>
21−<tr class="odd">
22−<td>aaaaaaaaaaaa</td>
23−<td></td>
24−<td>cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc</td>
25−</tr>
26−</tbody>
27−</table>
7+| aaaaaaaaaaaa | bbbbb | ccccccccccc |
8+|--------------|-------|--------------------------------------------------------------------------|
9+| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
2810```
2911
3012```