org-mode
中代码段的内容如下:
#+begin_src bash
cd ~
ls -la
find . -name .bashrc
#+end_src
html
的实际显示效果如下:
html
文件中代码段的内容如下:
<div class="org-src-container">
<pre class="src src-bash"><span class="org-builtin">cd</span> ~
ls -la
find . -name .bashrc
</pre>
</div>
感觉htmlize.el
没有起作用. 软件和插件版本如下: Emacs version: 26.1
, Org-mode version: 9.1.9
, htmlize.el version: 1.55
.emacs
中的配置如下:
(require 'htmlize)
(setq org-src-fontify-natively t)
;; (setq org-html-htmlize-output-type 'css)
...
(let ((org-publish-project-alist
'(("images"
:base-directory "src"
:base-extension "jpg\\|png\\|c\\|gif"
:publishing-directory "html"
:recursive t
:htmlized-source t
:publishing-function org-publish-attachment)
("static"
:base-directory "static"
:base-extension "jpg\\|png\\|c\\|gif\\|css\\|js\\|html\\|ttf\\|svg\\|otf\\|eot\\|woff\\|woff2"
:publishing-directory "html/static"
:recursive t
:htmlized-source t
:publishing-function org-publish-attachment)
("wiki-src"
:base-directory "src"
:base-extension "org"
:publishing-directory "html"
:recursive t
:htmlized-source t
:publishing-function org-html-publish-to-html
:headline-levels 4)
("wiki-project" :components ("wiki-src" "static" "images"))))
;;; 设置CSS样式
;; (org-html-head-extra "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/test.css\" />")
(org-html-head-extra "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/bootstrap-fontawesome.css\" />")
;;; 取消默认的CSS
(org-html-head-include-default-style nil)
;;; 取消默认的Javascript代码
(org-html-head-include-scripts nil)
;;; XXX 用org-html-head可以设置<head>部分
;; (org-html-preamble (read-html-template "preamble.html"))
(org-html-preamble (read-html-template "default.html"))
;; (org-html-postamble (read-html-template "postamble.html"))
)
;;; 设置Mathjax库的路径
(add-to-list 'org-html-mathjax-options '(path "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"))
(org-publish-project "wiki-project"))