可以非常轻松地在.org文件中指定文本修饰符,如粗体,斜体,删除线等(see link)。
同样,有没有办法为.org文件的一小部分指定文本颜色,以便文本在导出的html文件中适当地着色?我认为这在快速拍摄高亮笔记时非常有用。
预期行为:
This is a sample sentence in normal text color.
<font color="red">
This is a sample sentence in red text color.
</font>
<font color="green">
This is a sample sentence in green text color.
</font>
&#13;
答案 0 :(得分:7)
您可以使用macro:
#+MACRO: color @@html:<font color="$1">$2</font>@@
* This is a test
This is a sample sentence in normal text color.
{{{color(red,This is a sample sentence in red text color.)}}}
{{{color(green,This is a sample sentence in green text color.)}}}
有限制,第二个参数不能包含逗号(可能还有其他一些字符)。
答案 1 :(得分:0)
如果您对宏感到恼火。然后将以下内容添加到您的 Emacs 配置中,
(org-add-link-type
"color"
(lambda (path)
(message (concat "color "
(progn (add-text-properties
0 (length path)
(list 'face `((t (:foreground ,path))))
path) path))))
(lambda (path desc format)
(cond
((eq format 'html)
(format "<span style=\"color:%s;\">%s</span>" path desc))
((eq format 'latex)
(format "{\\color{%s}%s}" path desc)))))
组织模式示例:
- This is [[color:green][green text]]
- This is [[color:red][red]]