Closed jbg-mnn closed 4 years ago
@jbg-mnn I can't say that I understand your description. Can you give me an example?
There are 2 concepts for horizontal positioning in this library:
left
, right
, center
).charAlign
or predAlign
. This will align the cell content of all cells in a column by the matched position.I don't support markdown for horizontal positioning but that should not be so hard to implement.
I would like to have support in Text.Layout.Table.Style similar to headerSepH
for the colons in a markdown horizontal positioning specification as in the following example:
+---------+---------+---------+
| columnA | columnB | columnC |
+:========+:=======:+========:+
| left | center | right |
+---------+---------+---------+
In the header separation line of columnA the left colon indicates left horizontal positioning, in columnB the two colons indicate centered positioning, and in columnC the right colon indicates right positioning.
I don't see how that is markdown. Markdown means you add format commands to the input. However, your example shows output. Do you want to add indicators to the table that show how content is aligned? It shouldn't be too hard to implement. However, I'm not sure how useful this feature is.
Please see pandoc extensions grid_tables and pipe_tables as described here: https://pandoc.org/MANUAL.html#tables. Both extensions support horizontal alignment specification using the colon notation. My example was intended to feed it into the pandoc toolchain.
I see. Well, the functions for producing tables are not made for that purpose and I think it would make the generation a bit too complicated. Maybe I could provide an extra function that generates output for pipe_tables
.
The way to implement that is probably on top of grid
:
map $ const '-'
and insert :
according to the position used.Ok, i will then patch the output of tableLines. Thanks anyway.
@jbg-mnn I have something prepared already but not yet decided how and where. If you have time to wait to until around Christmas then I might do another release.
That's very kind! Yes, I can wait until beginning of January. Thank you.
@jbg-mnn I added a module Text.Layout.Table.Pandoc
that provides a function for pipe_tables
. I might also support grid_tables
in the future but that requires a bit more refactoring.
Please let me know whether that works out for you and whether you need a release on hackage.
What about markdown support for horizontal positioning with ':'? The asciiS style is almost there with
asciiS { headerSepH = '=' }
. But the colons for horizontal positioning are missing. Could you imagine to add it?