Formatting markdown tables in bbedit

89 views
Skip to first unread message

Rainer Krug

unread,
Apr 13, 2022, 7:48:44 AM4/13/22
to BBEdit Talk
Hi
How can I align the | in a markdown table in bbedit? 
Any scripts / filters which help me working with tables in bbedit? 
All the ones I found are REALLY old.

Thanks,

Rainer

jj

unread,
Apr 13, 2022, 8:57:35 AM4/13/22
to BBEdit Talk
Hi Rainer,

Did you check https://github.com/darkriszty/MarkdownTablePrettify-VSCodeExt ?

Install with:

    % brew install node
    % npm install -g markdown-table-prettify
   
Create a BBEdit Text Filter ~/Library/Application Support/BBEdit/Text Filters/markdown_table_prettify.sh:

    #!/usr/bin/env node
    const { CliPrettify } = require('markdown-table-prettify');
    process.stdin.setEncoding('utf8');
   
    process.stdin.on('data', function(text) {
      console.log(CliPrettify.prettify(text));
    })

HTH,

Jean Jourdain

Rainer Krug

unread,
Apr 13, 2022, 10:32:00 AM4/13/22
to BBEdit Talk
Thanks brilliant - that worked, but I had to install without the `-g` option.

Watts Martin

unread,
Apr 15, 2022, 7:45:32 PM4/15/22
to bbe...@googlegroups.com
While this is a bit late, I use Brett Terpstra's Markdown Service Tools for doing this -- and occasionally other Markdown-ish things -- in BBEdit, as well as other apps. If you use Markdown a lot, it's worth checking out.


-- Watts

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/1a312de4-36b8-4378-b49a-bd7d5961091an%40googlegroups.com.

Rainer Krug

unread,
Apr 24, 2022, 6:46:16 AM4/24/22
to BBEdit Talk
This is a nice collection - thanks roper ;pointing it out. Useful.

Thanks

Rainer

Tim Gray

unread,
May 14, 2022, 4:48:28 PM5/14/22
to BBEdit Talk
I hesitate to share these scripts because I can't really vouch for them being particularly cleaned up, but here they are anyway:


I'm pretty sure I started working from some scripts at Dr. Drang's site:


Anyway, there are 4 scripts:
- tabs2table.pl - takes tab delimited data and converts it to a markdown table
- table2tabs.pl - does the reverse
- spaces2tabs-table.pl - Takes columns separated by 2 or more spaces and/or tabs and converts to a single tab - this was some cleanup script I must have written and could easily be just a find and replace.
- Reformat table.py - Cleans up a markdown table (like from tabs2table.pl) and justifies the columns.  I'm pretty sure I modified this slightly from the one from leancrew to change the default column alignment.

I do have a similar script for doing the same with Latex tables, but it's on my work computer...  I could fetch them if there is interest.

Tim
Reply all
Reply to author
Forward
0 new messages