emacs怎么修改org导出html的格式

2025-03-25 05:01:03
推荐回答(1个)
回答1:

修改ox-html.el文件
目录修改如下:
;;; Tables of Contents

(defun org-html-toc (depth info)
"Build a table of contents.
DEPTH is an integer specifying the depth of the table. INFO is a
plist used as a communication channel. Return the table of
contents as a string, or nil if it is empty."
(let ((toc-entries
(mapcar (lambda (headline)
(cons (org-html--format-toc-headline headline info)
(org-export-get-relative-level headline info)))
(org-export-collect-headlines info depth)))
(outer-tag (if (and (org-html-html5-p info)
(plist-get info :html-html5-fancy))
"nav"
"div")))
(when toc-entries
(concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
(format "%s\n"
org-html-toplevel-hlevel
(org-html--translate "Table of Contents" info);;修改目录
org-html-toplevel-hlevel)
"

"
(org-html--toc-text toc-entries)
"
\n"
(format "\n" outer-tag)))))