Make markdown table syntax more compatible

[expired user #8299]'s profile image [expired user #8299] posted 8 years ago in General Permalink

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?

[expired user #8299]'s profile image [expired user #8299] posted 8 years ago Permalink

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

ansgar's profile image ansgar posted 8 years ago Permalink

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

Code modification/commit d75ae73 from ansgarbecker, 8 years ago, revision 9.4.0.5143
Make Markdown export code compatible to the parser on gitlab.com, by using 3 dashes instead of 1, below header columns. See http://www.heidisql.com/forum.php?t=22991
ansgar's profile image ansgar posted 8 years ago Permalink

Done in r5143

[expired user #10527]'s profile image [expired user #10527] posted 8 years ago Permalink

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's profile image ansgar posted 8 years ago Permalink

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?

[expired user #10527]'s profile image [expired user #10527] posted 8 years ago Permalink

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.