-
Notifications
You must be signed in to change notification settings - Fork 236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am certainly no expert on haddock, but looks good to me on a first glance
table :: Maybe [DocH () a] -> [[DocH () a]] -> Doc a | ||
table header rows = DocTable (Table header rows) | ||
|
||
it "parses a table with an header" $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed(up).
Tables are composed by an optional header and body. The header is composed by a single row. The body is composed by a non-empty list of rows. Example table with header: +----------+----------+ | /32bit/ | 64bit | +==========+==========+ | 0x0000 | @0x0000@ | +----------+----------+ See haskell#530
👍 |
I've definitely used lists where I wanted tables in my docs. This is a real improvement: looks good in the source and looks great when rendered. Worth noting that Emacs, at least, supports editing this style of table. |
At the risk of bikeshedding, will other forms of table be supported? This seems to copy what Pandoc calls "grid tables", but my general preference is for what it refers to as "pipe tables" (in part because I've tried editing this style of table in Emacs as @TikhonJelvis points out but found it very slow, but pipe-tables with |
I don't think this is properly specified yet and the tests don't look very comprehensive. |
@mpickering can you give me more info about what is it missing to be properly specified? |
@TikhonJelvis a note: the parser, the way it's been implemented, doesn't support table elements on multiple lines. |
@bgamari you seem quite active on this repo, what do you think about this change? |
@potomak Don't close this PR. Tables are a useful feature and we want it! Maybe @mpickering can clarify his concerns so they can be addressed. |
@potomak I see there is no documentation at all. I think it would help to add a few sentences to |
@alexbiehl great! Thanks for the suggestion. I will update the documentation. I'm also working on a second version of this PR, it uses a different approach at table parsing. I will the PR soon. |
parseTableContent :: Parser [[DocH mod Identifier]] | ||
parseTableContent = many1 (parseTableRow <* parseTableRowDivider) | ||
|
||
parseTableRow :: Parser [DocH mod Identifier] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should provide some way to escape |
in table cells. Otherwise typing |
results in odd parser errors.
@potomak what is the status on this one? Do you need any help/advice on moving this forward? |
@potomak you mentioned a 2nd version of this PR; what's the status on that? and why did you think a different version was needed? |
Simple parser is done by Giovanni Cappellotto (@potomak) in haskell#577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ?
* Add table examples * Add table types and adopt simple parser Simple parser is done by Giovanni Cappellotto (@potomak) in #577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ? * Implement grid-tables * Refactor table parser * Add two ill-examples * Update CHANGES.md * Basic documentation for tables * Fix documentation example
This has been addressed in another pr. |
* Add table examples * Add table types and adopt simple parser Simple parser is done by Giovanni Cappellotto (@potomak) in haskell#577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ? * Implement grid-tables * Refactor table parser * Add two ill-examples * Update CHANGES.md * Basic documentation for tables * Fix documentation example
* Add table examples * Add table types and adopt simple parser Simple parser is done by Giovanni Cappellotto (@potomak) in #577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ? * Implement grid-tables * Refactor table parser * Add two ill-examples * Update CHANGES.md * Basic documentation for tables * Fix documentation example
* Add table examples * Add table types and adopt simple parser Simple parser is done by Giovanni Cappellotto (@potomak) in haskell#577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ? * Implement grid-tables * Refactor table parser * Add two ill-examples * Update CHANGES.md * Basic documentation for tables * Fix documentation example (cherry picked from commit 088b199)
* Add table examples * Add table types and adopt simple parser Simple parser is done by Giovanni Cappellotto (@potomak) in haskell/haddock#577 It seems to support single fine full tables, so far from full RST-grid tables, but it's good start. Table type support row- and colspans, but obviously parser is lacking. Still TODO: - Latex backend. Should we use multirow package https://ctan.org/pkg/multirow?lang=en? - Hoogle backend: ? * Implement grid-tables * Refactor table parser * Add two ill-examples * Update CHANGES.md * Basic documentation for tables * Fix documentation example
Tables are composed by an optional header and body. The header is
composed by a single row. The body is composed by a non-empty list of
rows.
Example table with header:
Example table without header:
Example doc page (Classic theme):
Example doc page (Ocean theme):
See #530.