I would like to generate tables that have headers from code blocks. Something like this:
#+BEGIN_SRC emacs-lisp :results value table :table-header | First | Second |
(identity '((a b) (c d)))
#+END_SRC
#+RESULTS:
| First | Second |
|-------+--------|
| a | b |
| c | d |
Unfortunately something like :table-header | First | Second |
does not exist. Or rather I am hoping that I am overlooking something. (Here I am using (identity ...)
as a placeholder for code which actually calculates a value.)
This workaround doesn't quite do it for me:
#+BEGIN_SRC emacs-lisp :results value table
(cons (list "First" "Second")
(identity '((a b) (c d))))
#+END_SRC
#+RESULTS:
| First | Second |
| a | b |
| c | d |
I have to modify the content of the code block and the resulting header is not actually a header row, its a row like any other.
Related to this (but not 100% the same, above I would like to avoid having to put table setup instructions inside the code block, below that is required), is there a special element that causes the insertion of a separator? Something like:
#+BEGIN_SRC emacs-lisp :results value table
(nconc (identity '((a b) (c d))) ; calculated value A
(list 'linebreak) ; explicitly inserted linebreak
(identity '((A B) (C D)))) ; calculated value B
#+END_SRC
#+RESULTS:
| a | b |
| c | d |
|---+---|
| A | B |
| B | D |