问题
Hackage has been able to display Markdown READMEs for a while.
But as one can see for example on the Hackage page for hpack, Hackage doesn't seem to support the same table syntax as GitHub.
Markdown:
#### <a name="flags"></a>Flags
| Hpack | Cabal | Default | Notes |
| --- | --- | --- | --- |
| `description` | `description` | | Optional |
| `manual` | `manual` | | Required (unlike Cabal) |
| `default` | `default` | | Required (unlike Cabal) |
Rendered on GitHub:
Rendered on Hackage:
So, I'm wondering:
- Which Markdown dialect does Hackage support?
- Is there a syntax for tables in that dialect?
- Is there a syntax for tables in the subset of Markdown that is supported by both GitHub and Hackage?
回答1:
A quick search through the source of Hackage shows that is uses cheapskate (by John MacFarlane, the author of Pandoc). Looking at the Cheapskate.Types you can see everything that is supported - and tables are not part of that.
Furthermore, it appears that Hackage has the raw HTML option for rendering set to False, thereby quashing any hope one may have had of putting in a simple HTML table (which I think should also work in GitHub).
I think the best alternative (supported by both Hackage and GitHub) is just to put your table in a code block. That way, it is at least monospace font (so columns can align). That means you enter something like
```
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+
```
And it will render as
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+
来源:https://stackoverflow.com/questions/41623846/which-dialect-of-markdown-does-hackage-use-to-render-readmes