在org-mode中将内联代码导出为html

时间:2012-10-22 01:20:52

标签: emacs org-mode

我想要的org-mode与Markdown语言X <- 3中的内联代码块语法类似。我用Google搜索并尝试了(reference):

src_R{X <- 3}

在org-mode中内联,但是导出到html(使用 C-c C-e h )没有显示内联代码。像#+begin_src R这样的其他代码块工作正常,但无论如何在导出时都会出现警告消息:

htmlize.el 1.34 or later is needed for source code formatting [14 times]

这可能是原因吗?

更新

感谢@LeVieuxGildas的意见,我现在安装并加载了最新的htmlize.el版本1.43,并且在导出时没有收到任何错误消息。但仍然导出html无法显示内联代码部分。

系统:OS X 10.8.2; emacs mac port https://github.com/railwaycat/emacs-mac-port;内置组织模式

2 个答案:

答案 0 :(得分:7)

我想我们在这里谈论两件事。如果您只想像Markdown中的反引号一样“显示代码”,请用等号围绕内联代码,如:

Write messages in JavaScript using: =console.log(x, y)=

但是,使用src_XYZ{abc}尝试将其作为代码进行评估并返回结果。

答案 1 :(得分:3)

快速而肮脏的解决方案是修改先前内联代码中的标头参数。

src_R[:exports code]{X <- 3}

在我看来,内联代码比=code=~code~要好得多,因为如果将组织文件输出为Latex文件,它可以突出显示语法。