So first, the good news, I have my meds sorted out and it seems like I’m back on track. I’m sure I’ll talk more about it on Overtired, and will post more of the story here after I’m sure things have leveled out. I’m primarily directing my energy toward BitWriter (the nvALT update), but wanted a morning project, thus…
This tool converts CSV style input to MultiMarkdown tables. It’s based on Christopher Brandow’s Swift utility that I linked a little bit back. I took the idea and rebuilt it in Ruby, added handling for a few things I considered missing, and turned it into a Markdown Service Tool.
The Service lets you use simple CSV syntax for creating MultiMarkdown tables. Comma-separated cells, and alignment row is built based on Christopher’s syntax using “<”, “>”, and “=” (left, right, center).
This version allows the use of double quotes to include a comma within a cell, handles “cleaning” (justifying spaces based on alignment), and adds a few extra syntax characters.
Here’s a rundown:
Use CSV formatting, with cells separated by commas and newlines defining end of row.
A second row containing only <, >, =, and commas (whitespace ignored) can be added to force column aligment. If this row isn’t found, one will be created for you with a default “center” value for every column.
Header 1, Header 2, Header 3
<,<,=
Data 1, Data 2, Data 3
An alignment row must contain the same number of cells as the longest row. Because this tool can handle figuring out how to pad rows of different lengths, it’s forgiving in every area except this row.
Table caption
A line beginning with == at the beginning or the end of the CSV input will create a table caption.
| one | two, and a half | three and a quarter | | |
| ----: | :-------------: | :-----------------: | :---: | :---- |
| four | five | | | six |
|||||
| hell || hath no | fury | |
[Title]
The Markdown Service Tools are a collection of macOS Services designed to make creating Markdown-formatted text that much easier. Services work in almos any macOS application.