如何在 Haddock 文档中生成 table
How to generate a table in Haddock documentation
我正在用 Haddock 编写一些文档,我需要在其中放置一个包含一些值的多列 table。我怎么能用黑线鳕做呢?我找不到有关它的信息。嵌入一些 html 作为替代看起来也不可能。
Haddock "markup" doesn't currently support tables, see also Haddock User Guide - Chapter 3. Documentation and Markup. There is an open issue 添加对简单表格的支持。
与 GHC 8.4 或更新版本(Haddock 版本 >= 2.18.2)捆绑在一起的 Haddock 支持表格。根据 the pull request where this was added, the syntax is based on RST Grid tables.
示例使用:
module Sample where
-- | A table:
--
-- +------------------------+------------+----------+----------+
-- | Header row, column 1 | Header 2 | Header 3 | Header 4 |
-- | (header rows optional) | | | |
-- +========================+============+==========+==========+
-- | body row 1, column 1 | column 2 | column 3 | column 4 |
-- +------------------------+------------+----------+----------+
-- | body row 2 | Cells may span columns. |
-- +------------------------+------------+---------------------+
-- | body row 3 | Cells may | \[ |
-- +------------------------+ span rows. | f(n) = \sum_{i=1} |
-- | body row 4 | | \] |
-- +------------------------+------------+---------------------+
sample :: ()
sample = ()
变成
我正在用 Haddock 编写一些文档,我需要在其中放置一个包含一些值的多列 table。我怎么能用黑线鳕做呢?我找不到有关它的信息。嵌入一些 html 作为替代看起来也不可能。
Haddock "markup" doesn't currently support tables, see also Haddock User Guide - Chapter 3. Documentation and Markup. There is an open issue 添加对简单表格的支持。
与 GHC 8.4 或更新版本(Haddock 版本 >= 2.18.2)捆绑在一起的 Haddock 支持表格。根据 the pull request where this was added, the syntax is based on RST Grid tables.
示例使用:
module Sample where
-- | A table:
--
-- +------------------------+------------+----------+----------+
-- | Header row, column 1 | Header 2 | Header 3 | Header 4 |
-- | (header rows optional) | | | |
-- +========================+============+==========+==========+
-- | body row 1, column 1 | column 2 | column 3 | column 4 |
-- +------------------------+------------+----------+----------+
-- | body row 2 | Cells may span columns. |
-- +------------------------+------------+---------------------+
-- | body row 3 | Cells may | \[ |
-- +------------------------+ span rows. | f(n) = \sum_{i=1} |
-- | body row 4 | | \] |
-- +------------------------+------------+---------------------+
sample :: ()
sample = ()
变成