【发布时间】:2016-06-26 00:47:55
【问题描述】:
如果我在 orgmode 中有一个代码块,我可以使用 :exports both 选项导出它的评估。
#+begin_src cpp -n :includes <iostream> :exports both
std::cout << "Hello there";
#+end_src
#+RESULTS:
: Hello there
当我导出到 html (C-c C-e h o) 时,结果块跟在代码块后面。但是,我想更明确地表明,第二个块是第一个块的结果,比如一个简单的标签。
如果我修改上面的,像这样:
#+begin_src cpp -n :includes <iostream> :exports both
std::cout << "Hello there";
#+end_src
Output:
#+RESULTS:
: Hello there
然后出现标签“输出:”,但结果块出现两次——一次在标签之前,一次在标签之后。更糟糕的是,如果我在 orgmode (C-c C-c) 中运行代码,则会在文本标签“输出:”之前放置第二个结果块。我怀疑这也是出口的情况。
我还注意到,当导出为 html 时,结果块被放置在 example 类的 pre 标记中。我想我可以用类似的东西修改css:
pre.example::before { content: "Output:"; }
但不幸的是,这会将文本放在pre 块内,我无法添加任何换行符。
是否有任何简单的方法可以在 orgmode 本身或通过 css 中将文本标签添加到结果块?如果可能,我想避免使用 javascript。
【问题讨论】: