运行“组织导出为html';在emacs批处理模式下
在批处理模式下使用“org export as html”时,由代码块生成的html没有语法着色 如何在批处理模式下启用语法着色 编辑: 从终端运行运行“组织导出为html';在emacs批处理模式下,emacs,org-mode,Emacs,Org Mode,在批处理模式下使用“org export as html”时,由代码块生成的html没有语法着色 如何在批处理模式下启用语法着色 编辑: 从终端运行emacs--scriptmake.el。 在make.el中,我包括org和org html,并最终调用(org导出为html 3) 以下内容将以粗体/下划线显示关键字,但仍然没有颜色: (add-to-list 'load-path "~/elisp/org/contrib/lisp") (require 'htmlize)
emacs--scriptmake.el
。
在make.el中,我包括org和org html,并最终调用(org导出为html 3)
以下内容将以粗体/下划线显示关键字,但仍然没有颜色:
(add-to-list 'load-path "~/elisp/org/contrib/lisp")
(require 'htmlize)
(setq c-standard-font-lock-fontify-region-function 'font-lock-default-fontify-region) ;; fixes bug
(org-export-as-html 3)
编辑2:
我还尝试了几件事——它们没有什么区别:
(setq org-src-fontify-natively t)
(org-babel-do-load-languages 'org-babel-load-languages '((java .t)))
我还尝试加载我的整个.emacs
我正在使用GNU Emacs 24.3.1和Org 7.9.2显然,如果您使用
颜色主题
库,那么(出于我还不知道的神秘原因),当以批处理模式导出时,您可以通过htmlize
获得彩色输出
例如,评估要导出的组织缓冲区中的以下代码会使htmlize
使用通过主题定义的颜色,并且在以批处理模式和交互方式导出时都有效(通过创建临时框架并设置适当的颜色主题以避免弄乱包含要导出的组织缓冲区的框架):
请尝试
emacs--batch-l~/.emacs…
Hi您可以发布用于导出html的代码吗?我猜您没有要求使用htmlize
库,该库是导出语法突出显示的htmlHave所需的。您尝试过加载,例如(加载“~/elisp/org/contrib/lisp/htmlize”)
。这对我来说是个好办法。
(require 'cl) ;for `lexical-let'
(add-hook
;; This is for org 8.x (use `org-export-first-hook' for earlier versions).
(make-local-variable 'org-export-before-processing-hook)
(lambda (backend)
(add-to-list (make-local-variable 'load-path) (expand-file-name "./etc"))
(require 'color-theme)
(color-theme-initialize)
(when (display-graphic-p) ;Are we running in interactive mode?
;; If so, create a temporary frame to install the color theme used by
;; htmlize:
(lexical-let ((buff (switch-to-buffer-other-frame (current-buffer)))
(frame (selected-frame)))
(setq color-theme-is-global nil)
(make-frame-invisible frame)
;; Schedule deletion of temporary frame:
(add-to-list
;; The following is for org 8.x (earlier versions use other hooks like
;; `org-latex-final-hook').
(make-local-variable 'org-export-filter-final-output-functions)
(lambda (string backend info) (delete-frame frame)))))
;; Install color theme.
(color-theme-blippblopp)))