Make markdown table syntax more compatible

chris4beta posted 5 months ago in General

Most markdown parsers require at least one dash in the header separator, so

| id | name | email | bal | 
| -: | - | - | -: | 
| 5 | chris | foo | 12089 |

would be valid. I found that Gitlab's parser does not like this, and requires 3.

Making the separator 3 dashes long does not affect rendering anywhere else that I've seen, as the "at least one dash" requirement is met.

| id | name | email | bal | 
| ---: | --- | --- | ---: | 
| 5 | chris | foo | 12089 |

Your parser renders it correctly too:

id name email bal
5 chris foo 12089

Can the markdown output be updated to use 3 dashes instead of 1?

chris4beta posted 5 months ago

Sorry, this should be in Feature Discussion but I can't seem to edit after the fact.

ansgar posted 5 months ago

Yes, I can do that. It's always the question if that's not breaking other things, which you already checked.

ansgar posted 5 months ago

Done in r5143

Mifczu posted 4 months ago

it's a great option. Can you do it so that the table looks good without formatting? In the above example:

| id   | name  | email |   bal | 
| ---: | ----- | ----- | ----: | 
|    5 | chris | foo   | 12089 |

This is useful when the text is pasted somewhere where has no formatting or columns is a lot.

ansgar posted 3 months ago

Hm, that requires some look-ahead into the data before creating any value, so Heidi knows the minimum width of each column, right? Should have some hardcoded max-width too I guess, so blob/text columns with megabytes of text don't get too wide, right?

Mifczu posted 3 months ago

Yes, you have to iterate through all the data to check the size. But as we will use the mysql client from cli is a table in the asci are drawn in good widths.

As for the field blob/text then you need to shift responsibility fully for the user. Displays a large column of this table will be wide.

Please login to leave a reply, or register at first.