Trying to see if there’s any interest? Take a look at the GIF below but effectively, I’m making Markdown tables easier to read while editing. I have more table functions coming as well (such as tab to next cell).
I’m still sorting out a couple of edge cases so it’s not quite ready to share. Happy to get feedback!
Note: this works best if the syntax you’re using makes table render in monospace
Sweet. I’d use it! I use multimarkdown extensively, often want to use tables for simple organization, but hate having to fiddle with the spacing, go out to TableFlip, use a preview mode, etc.
… In my md2pptx Markdown to PowerPoint converter I support tables. But rendering them in Drafts has been tricky. So I have to imagine what they’d look like in a slide.
So this would be very helpful.
There is an extra thing as do - which isn’t part of the Markdown Tables spec - that you might consider…
While the spec supports alignment it doesn’t support width specifications. So, in md2pptx, I count the number of spaces in a column’s header and use that as a proportion. Example:
|:-|--:|
would yield a table where the first column is left aligned and single width. The second column is right aligned - which you support - and double width.
It’s something to consider. Of course the width specifications are thrown away by REAL Markdown renderers but no harm done.
(In reality in my mdpre Markdown preprocessor I can convert CSV to Markdown tables and use the =colalign and =colwidth commands to denote alignments and widths. I’m not suggesting you adopt these, though.)
I actually don’t support right alignment yet, but that’s something I’ll add for sure. Maybe not in the first drop but soon after! Thanks for the feedback!
Alignments - which you’re about to do - is standard for any reasonable Markdown that supports tables.
Relative widths - measured by number of dashes - isn’t standard but I find it incredibly helpful when composing tables on slides. In general, you’re supposed to let eg HTML decide the widths (based on content) but I find that painful. If I could find a better but as compact way of specifying widths - in md2pptx - I would.
But I’m really glad you’re continuing to evolve this. Thanks!
First version has been posted to the Directory. Feedback and testing absolutely welcomed. Note, it’s deployed as an Action Group instead of different actions because I combine the core logic inside a library action for easier maintenance and less duplication.
@martinpacker, I’ve changed the padding logic to put in extra dashes when separating the header row from the rest of the table. Take a look at the updated demo GIF below.
Nice! How do you know how many dashes to add? My conception is YOU tell IT - and it uses the number you specify to decide how to divide up the horizontal space.
But I now notice you’re not rendering but replacing the source text.
The number of dashes for a given column is equal to the longest string trimmed string in that given column - 1 (to include the ‘:’). So if you want increase the width, you can manually add more dashes. If you want to decrease, it won’t work because as far as I know, MD tables can’t do multi-line rows so you can’t compress that down.
You’re also right that I’m not rendering the table, I’m replacing the text with non-destructive edits. Hope it’s still of use!
You’re giving me a quick idea for a new action to “resize” column widths though with a simple dialog.
Feature : Support for right and centre alignment Feature: Insert Row action added Fix : Detection of end of tables was sometimes adding extra | on new lines. Code refactor : Starting to make the code in the library easier to modify and work with
To everyone else interested, check out the latest updated action group:
New Feature: Insert Column Improvement: Complete re-write of table detection logic to leverage regex. Results in much more accurate table detection and improved formatting Cleanup: Cleaned up some bad code based on advice from SonarLint suggestions and my own eyeballs. Makes it easier to work with/read.
I’m contemplating writing CSV import/export. Any appetite here?
I’d be quite interested in CSV tools. I store a lot of data in csv for reference purposes, and it would be neat to be able to bring some of that into Drafts for review, for example, without having to fire up a spreadsheet, database manager or script.
I kept it in an action to avoid iCloud Library file unloading (not sure it that would actually happen).
I also made the MD Table Library “action” hidden because it’s not really an action. Double clicking it doesn’t do anything so in my mind, it should show up in the action bar/list. I’m very open to feedback.
When I used the action recently, not much seemed to happen. I think this is because my (custom) syntax is not monospace. Is there something I should do to make tables appear in a monospace font?