christiaanderidder / QuestPDF.Markdown

QuestPDF.Markdown allows rendering markdown into a QuestPDF document
MIT License
29 stars 7 forks source link

GridTables row/colspan does not work as expected #74

Closed christiaanderidder closed 3 months ago

christiaanderidder commented 3 months ago

Investigate whether GridTables row/colspan works as expected.


Originally posted by @liam-silvatech in https://github.com/christiaanderidder/QuestPDF.Markdown/issues/71#issuecomment-2270801302


The other aspect of GridTables I can't get to work is merging cells. If I make a row span multiple columns then that isn't replicated.

I think if we took the examples of GridTables from the extension documentation and got that working that is a good approach for validation.

https://pandoc.org/chunkedhtml-demo/8.9-tables.html

I'm using GridTables as I have a complex document to replicate in markdown and I've got it nearly complete once I can span columns.

To be fair I should be using the Markdig examples as validation, as it's not quite the same as pandoc.

https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/GridTableSpecs.md

christiaanderidder commented 3 months ago

@liam-silvatech I've created this issue based on your comment in #71

I gave it a quick test with a (slightly modified to force line breaks between the AAA lines) sample from the Markdig library and it gives me the following result:

+---+---+---+
| AAA \ | B |
+ AAA \ +---+
| AAA   | C |
+---+---+---+
| D | E | F |
+---+---+---+
image

Besides that the columns might not be very clear due to the zebra-table styling, it seems to apply the row and colspan as expected.

liam-silvatech commented 3 months ago

Thanks @christiaanderidder

I am wondering if I am not using GridTables correctly.

My expectation is the first two rows are merged columns and that the other rows have the first column taking up 25% and the second column taking up 75%.

The table is oversized to increase the integer to achieve the 75% column width.

Reading the GridTable specification I think this is a valid table.

+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Lorem ipsum odor amet, consectetuer adipiscing elit. Dignissim rhoncus lacus montes iaculis efficitur. Augue hendrerit fringilla faucibus ridiculus fringi                        |
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Lorem ipsum odor amet, consectetuer adipiscing elit. Dignissim rhoncus lacus montes iaculis efficitur. Augue hendrerit fr                                                         |
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Lorem ip**                               | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
|                                            | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
|                                            | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Lorem ip**                               | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
|                                            | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
|                                            | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Lorem ipsum odo**                        | - Lorem ipsum odor amet, consectetuer adipiscing elit.                                                                               |
+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
christiaanderidder commented 3 months ago

@liam-silvatech There was indeed a bug handling colspans, a fix will be released in the next version