Code blocks inside tables for org-mode

荒凉一梦 提交于 2019-12-05 08:23:37

You cannot do that: you cannot escape the "|" character in a table entry: the best you can do is replace it with something that looks like it instead. There have been several questions on the ML about this and the best answer seems to be the Unicode character at #xa6 (¦) - see e.g. this message and the enclosing thread.

However, you can store links to code blocks in the table. Inside a code block, you can have arbitrary code so there is no problem with special characters there, and as a bonus, you can execute the code blocks.

Something like this:

* Table of code blocks

| Name | Code block |
|------+------------|
| foo  | [[foo][foo]]        |
| bar  | [[bar][bar]]        |


#+name: foo
#+begin_src bash
echo "Foo"
#+end_src

#+RESULTS: foo
: Foo

#+name: bar
#+begin_src bash
echo "Bar"
#+end_src
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!