Markdown Export Format

[expired user #6833]'s profile image [expired user #6833] posted 9 years ago in Import/Export Permalink
I would love the ability to export query results to Markdown syntax. It's not too hard to export to "Wiki Markup" and run some regex to turn it into Markdown. Perhaps if you choose wiki format you can have some options as to which format (I know there are a few different flavors of markdown tables).

The format I'm currently working with is https://www.dokuwiki.org/wiki:syntax#tables.
[expired user #6645]'s profile image [expired user #6645] posted 9 years ago Permalink
Yeah, Agree.

Markdown is now a must. Several times I use markdown to communicate data results.

ansgar's profile image ansgar posted 9 years ago Permalink
I guess this example is what it should look like in the end:
^           Table with alignment           ^^^
|         right|    center    |left          |
|left          |         right|    center    |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
ansgar's profile image ansgar posted 9 years ago Permalink
Fixed link without dot: https://www.dokuwiki.org/wiki:syntax#tables
ansgar's profile image ansgar posted 9 years ago Permalink
I'm just reading that Markdown does not support tables!?

Two online Markdown editors do not parse any of the table markup:
* http://www.dillinger.io/
* https://stackedit.io/

Markdown Here is the extension which supports tables. But even this one has a different syntax than documented on dokuwiki.org.
ansgar's profile image ansgar posted 9 years ago Permalink
Also, multi lines in table cells are not supported. If you have new line characters, this will break the Markdown parser. I guess it would be a bad idea to replace new lines by spaces or such thing, as this breaks your data?
Code modification/commit from ansgarbecker, 9 years ago, revision 4939
Basic implementation of Markdown Here grid export option. See http://www.heidisql.com/forum.php?t=16483
ansgar's profile image ansgar posted 9 years ago Permalink
Please update to r4939 - and give feedback here.

Apart from broken multi line values in parsed Markdown export it should work as expected.
ansgar's profile image ansgar posted 9 years ago Permalink
Can somebody give some feedback for the current Markdown Here grid export, please? I have no clue if Markdown Here is preferred to some other subformat.
[expired user #8890]'s profile image [expired user #8890] posted 9 years ago Permalink
Personally, I would prefer the version of Markdown supported by GitHub: https://help.github.com/articles/github-flavored-markdown/#tables

Take note that even though that document doesn't mention it, the
| --------- |
line doesn't need to have so many hyphens. I believe the minimum is 3. So basically the way it differs from what you currently have is:
1. Remove your top line of 3 hyphens
2. Change the
| -: | -: | -: |
row to
| ---: | ---: | ---: |


That should be it.
[expired user #8904]'s profile image [expired user #8904] posted 9 years ago Permalink
Markdown export is great!

Additional to the comment by JMTyler I would suggest ensuring an empty line before the table. Some parsers are still picky and there are quite a lot of Markdown implementations. There is hope with the advent of http://commonmark.org, but the Spec still down not include tables.

I also hoped to have a very human readable markdown table in it text representation, which does align the columns for me using whitespaces (of course it would need to know the maximum length of each column to do that.

So instead of this (produces with Build 4948):

PERMISSION
---
| ID | NAME | DESC |
| -: | - | - |
| 81 | MANAGE_USERS | |
| 54 | ASSIGN_USERS_TO_SOMETHING | Assign the user to something |
| 2  | DEREGISTER | Allow deregistration of a user |


I would prefer a format for exporting as follows (correct alignment of columns) when pasting DB dumps to a markdown powered wiki or text-based tools.

PERMISSION
---
| ID  | NAME                      | DESC                           |
| --: | ------------------------- | ------------------------------ |
|  81 | MANAGE_USERS              |                                |
|  54 | ASSIGN_USERS_TO_SOMETHING | Assign the user to something   |
|   2 | DEREGISTER                | Allow deregistration of a user |


As this may cause some additional overhead for export to calculate column lengths it should probably require a config option to be enabled (e.g. [x] Improve readability).
[expired user #8904]'s profile image [expired user #8904] posted 9 years ago Permalink
Oops, forgot the empty line after the header myself.

So it should actually look like that...

PERMISSION
---
| ID  | NAME                      | DESC                           |
| --: | ------------------------- | ------------------------------ |
|  81 | MANAGE_USERS              |                                |
|  54 | ASSIGN_USERS_TO_SOMETHING | Assign the user to something   |
|   2 | DEREGISTER                | Allow deregistration of a user |
ansgar's profile image ansgar posted 8 years ago Permalink

Just a note: This forum now supports Markdown syntax as well. Read about the details here.

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

Would that mean the table format will be fixed too soon (see post by JMTyler 7 months ago).

I still don't regularly use the markdown export yet. Hope to see the export corrected so I can by lazy again.

ansgar's profile image ansgar posted 8 years ago Permalink

Well, why not. But I don't think this needs to be customizable via checkbox.

I should take that as a marketing argument for HeidiSQL:

Be lazy, use HeidiSQL!

Hehe.

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

Be lazy, use HeidiSQL!

You got me with this one ;-)

Looking forward to a new level of lazyness for my wiki interactions!

P.S.: Kudos for you work, Heidi is running extremely well on Linux, I'll think I have to donate again.

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