下面的示例改编自我用来撰写有关 Org-mode 的类似内容。它似乎也适用于您的用例。#+OPTIONS: d:RESULTS
确保:RESULTS:
抽屉被导出。将其放入 Org-mode 缓冲区并导出为 HTML。
#+OPTIONS: d:RESULTS
* Examples
The HTML source
#+name: eg-1
#+begin_src org :results replace drawer :exports both :post wrap-html(text=*this*)
A <b>bold</b> statement.
#+end_src
Results in the output
#+results: eg-1
* Utils :noexport:
#+name: wrap-html
#+begin_src emacs-lisp :var text="" :results raw
(concat "#+BEGIN_HTML\n<div class=\"html-output\">\n" text "\n</div>\n#+END_HTML")
#+end_src
您可以通过将它们作为属性添加到子树标题来避免重复标题,例如
* Example 2
:PROPERTIES:
:results: replace drawer
:exports: both
:post: wrap-html(text=*this*)
:END:
#+name: eg-2
#+begin_src org
Some <i>italic</i>.
#+end_src
#+results: eg-2
#+name: eg-3
#+begin_src org
You can <b>nest <i>inline</i> tags</b>.
#+end_src
#+results: eg-3
但请注意,除非明确覆盖,否则这些标头将应用于子树中的每个源块。