Markdown Table | Drafts Action Directory


#1

Posted by agiletortoise, Last update about 1 hour ago

Insert empty MultiMarkdown table markup. The action will prompt for the number of rows and columns, and create and insert MultiMarkdown table syntax for the table with header of the requested size, like:


This is a companion discussion topic for the original entry at https://actions.getdrafts.com/a/1T3

#2

interestingly, with multimarkdown as my selected markdown processor, this script does not display a table when i preview the document in drafts5.

however if i change the sexond line from:
|:—|:—|

to:
|----|----|

the table is displayed in the preview.

i did however learn about the availability of the numerical keyboard from this script so many thanks for that!

cheers,

-c.


#3

following up on this, the change above worked in the draft itself, however altering the code to use my row separator introduced a new issue where the very first character was a short dash, followed by x many ‘normal’ dashes (i had experimented with various numbers of dashes and also tried starting with a space character) causing the string of characters to be printed rather than a table. finally i swapped the dashes for equal signs and that worked like a charm.

i now have a working script that inserts a multimarkdown table into the current document. the change that worked was changing line 5 in the script:
let div = “|:–”;
to:
let div = “| ===”;

this is great as i had previously had the other create mmd table in the script repo installed and it never quite worked (for a similar reason) but I never got around to troubleshooting it. this script is much cleaner (and doesn’t introduce a delay after inserting as the other one does, a good 5 seconds have to pass before the app is responsive after using it to insert a table) and now it works perfectly.

cheers

-c.