Org-Mode, MailMate, and Tables something no one does, but even so, it's my blog
MailMate supports writing emails in MarkDown and also offers an extension to render tables; these get sent as a multi-part message that is MarkDown and HTML, so other mail readers can render them, too.
Org-Mode has, arguably, the best ASCII table editing environment, and those tables can be written by hand or generated from SQL, R, Python, etc. from within org-mode. Those tables can be rendered by org-mode as HTML, LaTeX, plain text, markdown, and other formats.
Getting the org-mode tables rendered as an appropriate MarkDown table that is suitable for insertion into MailMate is a great time saver for the three people I know who might do that (Paul K. and Matt B., I’m counting myself; if there is a fourth person, contact me, we can be friends).
For example, this table looks pretty nice in HTML on this blog (iidssm).
Name | Age |
---|---|
Andy | 43 |
Michelle | 43 |
Don | 69 |
Maddie | 7 |
Megan | 39 |
and what I typed was:
#+ORGTBL: SEND ages orgtbl-to-gfm | Name | Age | |----------+-----| | Andy | 43 | | Michelle | 43 | | Don | 69 | | Maddie | 7 | | Megan | 39 |
To go from the org table to the MarkDown table, these are the steps:
- Paste the contents of this Gist into your
.emacs
file: - Type or generate your table in org-mode, including the “
#ORGTBL: SEND
” line. - Create a place for the MarkDown table to go, perhaps into a
#+BEGIN/END COMMENT
block, using theBEGIN/END RECEIVE...
lines. - Switch from Org-mode to text mode:
M-x text-mode
- Enter the orgtbl minor mode:
M-x orgtbl-mode
- Move the point (cursor) to the
ORGTBL: SEND
line and pressC-c C-c
to generate the markdown table - Switch back to Org-mode:
M-x org-mode
That will produce this output
# BEGIN RECEIVE ORGTBL ages | Name | Age | |---|--:| | Andy | 43 | | Michelle | 43 | | Don | 69 | | Maddie | 7 | | Megan | 39 | # END RECEIVE ORGTBL ages
Now you can copy the MarkDown table to your MailMate message and it will render as a table.