本文介绍了Hackage使用哪种Markdown方言来呈现自述文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hackage能够显示Markdown自述文件

在黑客攻击下呈现:

所以,我想知道:

  • Hackage支持哪种Markdown方言?
  • 该方言中的表格是否有语法?
  • GitHub和Hackage是否都支持Markdown子集中的表的语法?

解决方案

快速搜索Hackage的来源显示使用的是 cheapskate (Pandoc的作者John MacFarlane).查看 Cheapskate.Types ,您可以看到所有受支持的内容-表格也不是其中的一部分.

此外,似乎黑客行为将用于呈现的原始HTML选项设置为 False ,从而打破了人们可能希望放在一个简单的HTML表中的任何希望(我认为这也应该在GitHub中起作用)./p>

我认为(Hackage和GitHub都支持)最好的选择就是将表放在代码块中.这样,它至少是等宽字体(以便列可以对齐).这意味着您输入类似

 ```|标头1 |标头2 |标头2 |+ --------- + --------- + --------- +|Cell1 |Cell2 |Cell3 |+ --------- + --------- + --------- +``` 

它将呈现为

  |标头1 |标头2 |标头2 |+ --------- + --------- + --------- +|Cell1 |Cell2 |Cell3 |+ --------- + --------- + --------- + 

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?

解决方案

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   |
+---------+---------+---------+

这篇关于Hackage使用哪种Markdown方言来呈现自述文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 02:15