Table markdown filter for tab and space delimited text

Tab delimited text in clipboard is filtered to table markdown. If no tabs are present, then input text is regarded as whitespace delimited. Handy for copy/paste from Excel, query results, etc. to Confluence, Github, etc.

Markup Tabelle.kmmacros (1.7 KB)

4 Likes

Very useful :slight_smile: Thanks for sharing!

Thanks for sharing. I can really use a macro like this.

Unfortunately, it is not working for me: Vertical bars are missing from some end of lines and beginning of lines. Please advise if I'm not using the macro correctly.

I copied a cell range (3x4) from Excel, a pasted into TextWrangler.
I then ran your macro, and pasted into TW again.

####Before Macro

(the triangles represent TABs in TextWrangler)

####After I ran Macro

|Apr 2017|21|1.19|3.65
Jan 2017|19|1.56|5.03
Dec 2016|19|1.28|2.2|

I had absolutely no idea Markdown supported tables. This information is unbelievably awesome! Thanks so much!

After another test, it seems that the problem might be with how Excel is setting the End of Line.

Here's a test completely in TextWrangler, and it works fine:

Depends on the flavor of Markdown. Some do, some don't.
The Discourse forum (used by KM forum) markdown does not support tables (yet)
But the KM Wiki does.

Good to know. Thanks.

I’m happy to know that GitHub does support tables. It will make it easier to document some code, when I finally get back around to doing that.

A nice cheatsheet. (MultiMarkdown)

2 Likes

Hey Folks,

Here's one that copies the selected text, trims off any vertical whitespace, and en-tables the resulting tab-delimited or space-delimited text.

-Chris


Create Markdown Table from Tab or Space Delimited Text.kmmacros (5.8 KB)

2 Likes

Chris, thanks for this. It works well with a copy from Excel.

Sorry, I could not reproduce your problem, it should work with your input. Works fine with Libre Office and SQL Developer and I don’t have Excel for testing. Btw, Libre Office or Excel are handy for pasting html tables, then copy, then use the KM macro.

But I read, that the KM only approach works fine for you. Amazing, that KM can do it without any external scripting. What a powerful tool, so much to explore…

I agree, it is amazing.
In this case, it is the power of RegEx offered by KM.