Which dialect of Markdown does Hackage use to render READMEs?

纵饮孤独 提交于 2021-01-02 17:04:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!