naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.04k stars 318 forks source link

Empty rows should not be rendered #1729

Open ericscheid opened 2 years ago

ericscheid commented 2 years ago

Consider this table, where very long text data has been split over multiple lines for editing reasons, and all the cells of the row are rowspanned into the above row..

| Race     | Multi-class options                                         |
|:---------|:------------------------------------------------------------|
| Dwarf    | fighter/cleric, fighter/thief                               |
| Elf      | fighter/mage, fighter/thief, mage/thief,                    |
|         ^| fighter/mage/thief                                         ^|
| Gnome    | fighter/thief, fighter/cleric, fighter/illusionist,         | 
|         ^| thief/cleric, thief/illusionist, cleric/illusionist        ^|
| Half-elf | fighter/priest, fighter/mage, fighter/thief, ranger/priest, |
|         ^| mage/priest, mage/thief,                                   ^|
|         ^| fighter/mage/priest, fighter/mage/thief                    ^|
| Halfling | fighter/thief                                               |
| Human    | none                                                        |

Unfortunately, the markdown renders this with empty <tr></tr>...

image

This is a bug, and it messes up the even/odd row striping:

image

calculuschild commented 2 years ago

Hmm interesting find. Good eye.

G-Ambatte commented 2 years ago

To further muddy the waters, if the <tr></tr> is removed completely, then the preceding rowspan(s) must also be decremented, or else the entire table format will break in new and interesting ways.

As I understand it, this is not actually the intended use of rowspan. I can see how it might be clearer in the editor and thus more convenient - but as per the current implementation, it doesn't actually work.

WORKAROUNDS:

It's worth noting that, despite the different approaches, the two tables above appear to be visually identical.

ericscheid commented 2 years ago

Oh, good point on decrementing rowspans.

dbolack-ab commented 1 month ago

Would the simplest fix be to strip empty pairs in html.renderer()?

Or must this be fixed in marked-extended-tables ?

calculuschild commented 1 month ago

Fixes to table generation should go in marked-extended-tables