emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Vicente Vera <vicentemvp@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>, Peter Davis <pfd@pfdstudio.com>
Subject: Re: exporting markdown with tables
Date: Sun, 4 Jun 2017 13:38:17 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1706041319170.1045@charles-berrys-macbook.local> (raw)
In-Reply-To: <CAMfbzvBYQ4R0dLuW4GH-xHjy7Re7ZN5R=yb+HUH28WtMYsSYTw@mail.gmail.com>

On Sun, 4 Jun 2017, Vicente Vera wrote:

> Cool, you're welcome. It is not the most convenient solution, but
> keeping your tables in Editorial Markdown syntax should work:
>
> #+BEGIN_EXPORT md
> Cat | Fur   |
> --- | ---   |
> A   | A lot |
> B   | None  |
> #+END_EXPORT
>

Except that the above is not recognized as a table, so all the nifty tools 
for table editing are lost.

IMO, a better solution is to create a filter for table-row that replaces 
the leading vertical with a space (or nothing) and bind that function to 
`org-export-filter-table-row-functions'. See

 	(info "(org) Advanced configuration")


---

However, those intimidated by filters can keep tables in org src blocks 
and convert them on export using a :post argument to clean the leading 
verticals.  That way the tables can be edited as usual via 
org-edit-src-code:

#+name: strip-leading-vertical
#+BEGIN_SRC emacs-lisp
(replace-regexp-in-string "^|" " " *this*)
#+END_SRC


#+header: :results replace :exports results
#+header: :post strip-leading-vertical() :wrap export md
#+BEGIN_SRC org
   | a | b |
   |---+---|
   | 1 | 2 |
   | 3 | 4 |
#+END_SRC

#+RESULTS:
#+BEGIN_export md
   a | b |
  ---+---|
   1 | 2 |
   3 | 4 |
#+END_export

A call to `(require 'ob-org)' or suitable customization is needed to 
enable the org src block to execute.

HTH,

Chuck

  reply	other threads:[~2017-06-04 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03 13:41 exporting markdown with tables Peter Davis
2017-06-03 16:31 ` Vicente Vera
2017-06-03 16:46   ` Peter Davis
2017-06-04 18:24     ` Vicente Vera
2017-06-04 20:38       ` Charles C. Berry [this message]
2017-06-04 21:57         ` Peter Davis
2017-06-04 10:49 ` Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.20.1706041319170.1045@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=pfd@pfdstudio.com \
    --cc=vicentemvp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).