将组织模式导出为HTML:就地着色

时间:2014-01-24 19:02:36

标签: html emacs org-mode

如何指定Emacs组织模式在将文件导出为HTML时应使用的文本的颜色?

e.g。

* Here is one bullet
  ** Here is another bullet
       Here is some text that I want in BOLD RED 
       Here is some other text that I want in the default face

4 个答案:

答案 0 :(得分:7)

你没有说这是不是一次性的。如果你需要样式,css样式表是有意义的。要完成您描述的内容,您可以在组织文件中包含red指令,如下所示:

Here is some text that I want in *@@html:<font color = "red">@@BOLD RED@@html:</font>@@*

请参阅组织手册中的引用HTML标记部分。

答案 1 :(得分:5)

杰弗里给出了答案。但是,要添加额外的信息,请知道我正忙于在GitHub上制作一个org-macros项目,其目标是使这些行为变得轻而易举。

该项目仍处于草稿状态(宏将无法正确导出到LaTeX),尚未提供完整的文档(虽然没关系,但您应该查看Org源代码的真实用法语法),但是如果你克隆https://github.com/fniessen/org-macros,你应该能够使用“bgcolor”,“颜色”或“突出显示”宏(在你的组织文件中包含org-macros.setup文件之后)。 / p>

你会写:

INCLUDE: path/to/org-macros.setup

Here is some text that I want in *{{{color(red, BOLD RED)}}}*.

当我将这些宏处于完成状态时,它们将适用于HTML和LaTeX(至少)。

答案 2 :(得分:1)

您可以使用HTML HEAD选项将自定义css样式表链接到导出的html文档:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />

看一下导出的html和分配给不同组织级别的类,你应该能够立刻把一个相当简单的样式表组合在一起。这里有一个很好的例子:https://gist.github.com/mowen/326524

以下是参考:http://orgmode.org/manual/CSS-support.html#CSS-support

答案 3 :(得分:1)

另一种方式。

* Here is one bullet
** Here is another bullet
#+begin_html 
Here is some text that I want in <span style='color:red'>BOLD RED</span>
#+end_html
Here is some other text that I want in the default face
相关问题