emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] exporting markdown with tables


From: Charles C. Berry
Subject: Re: [O] exporting markdown with tables
Date: Sun, 4 Jun 2017 13:38:17 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]