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.
This commit is contained in:
1 parent
34e6464e30
commit
7c2dd0359b
2 files changed
+6
-24
No files matched your search
@@ -628,15 +628,15 @@ blockToMarkdown' opts t@(Table caption aligns widths headers rows) = do
|
||||
writerColumns opts >= 8 * numcols -> (id,) <$>
|
||||
gridTable opts blockListToMarkdown
|
||||
(all null headers) aligns' widths' headers rows
|
||||
| isEnabled Ext_raw_html opts -> fmap (id,) $
|
||||
(text . T.unpack) <$>
|
||||
(writeHtml5String opts{ writerTemplate = Nothing } $ Pandoc nullMeta [t])
|
||||
| hasSimpleCells &&
|
||||
isEnabled Ext_pipe_tables opts -> do
|
||||
rawHeaders <- padRow <$> mapM (blockListToMarkdown opts) headers
|
||||
rawRows <- mapM (fmap padRow . mapM (blockListToMarkdown opts))
|
||||
rows
|
||||
(id,) <$> pipeTable (all null headers) aligns' rawHeaders rawRows
|
||||
| isEnabled Ext_raw_html opts -> fmap (id,) $
|
||||
(text . T.unpack) <$>
|
||||
(writeHtml5String opts{ writerTemplate = Nothing } $ Pandoc nullMeta [t])
|
||||
| otherwise -> return $ (id, text "[TABLE]")
|
||||
return $ nst (tbl $$ caption'') $$ blankline
|
||||
blockToMarkdown' opts (BulletList items) = do
|
||||
|
||||
+3
-21
@@ -4,27 +4,9 @@
|
||||
|--------------|-------|--------------------------------------------------------------------------|
|
||||
| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
|
||||
^D
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width: 14%" />
|
||||
<col style="width: 7%" />
|
||||
<col style="width: 77%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>aaaaaaaaaaaa</th>
|
||||
<th>bbbbb</th>
|
||||
<th>ccccccccccc</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>aaaaaaaaaaaa</td>
|
||||
<td></td>
|
||||
<td>cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
| aaaaaaaaaaaa | bbbbb | ccccccccccc |
|
||||
|--------------|-------|--------------------------------------------------------------------------|
|
||||
| aaaaaaaaaaaa | | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user