What I've found so far is this.
The "simplest" way is, as described in this stackoverflow answer and this gist, and as hinted by @Constantine in a comment, is to create a converter function and then use it.
I went a tad further in laziness (this might already exist somewhere, but hey, I've only got the one use case right now). So here's what I have:
The converter function
(defun orgtbl-to-gfm (table params)
"Convert the Orgtbl mode TABLE to GitHub Flavored Markdown."
(let* ((alignment (mapconcat (lambda (x) (if x "|--:" "|---"))
org-table-last-alignment ""))
(params2
(list
:splice t
:hline (concat alignment "|")
:lstart "| " :lend " |" :sep " | ")))
(orgtbl-to-generic table (org-combine-plists params2 params))))
Sample usage:
;; Usage Example:
;;
;; <!-- BEGIN RECEIVE ORGTBL ${1:YOUR_TABLE_NAME} -->
;; <!-- END RECEIVE ORGTBL $1 -->
;;
;; <!--
;; #+ORGTBL: SEND $1 orgtbl-to-gfm
;; | $0 |
;; -->
My lazy inserter
This is about the laziest piece of code I've written in years, but hey, it's gonna make sure that when I'm writing markdown, I'm really just writing markdown. I'll also welcome all improvements to this code.
Bonus: Github-Flavored Markdown, and Github's preview itself, doesn't show HTML-style comments, therefore this is completely transparent. Love it.
(defun stag-insert-org-to-md-table (table-name)
(interactive "*sEnter table name: ")
(insert "<!---
#+ORGTBL: SEND " table-name " orgtbl-to-gfm
-->
<!--- BEGIN RECEIVE ORGTBL " table-name " -->
<!--- END RECEIVE ORGTBL " table-name " -->")
(previous-line)
(previous-line)
(previous-line))
"+"
is hard-wired in several places inorg-table.el
. It should be pretty easy to write an exporter from Org to GitHub-flavored Markdown, though, and then you would not need markdown-mode! :-) (The vanilla Markdown exporter produces HTML code for tables.)