How to omit h1 title heading in HTML export

| 分类 Emacs  | 标签 org 

Introduce how to omit h1 title in the exported html.

Sometimes it would be better to omit h1 title in exported HTML, and there is an email discussing it. It is suggested to add customized filters to do this:

(defun rasmus/org-html-ignore-title-if-present (string backend info)
  "Strip title if it's already there for html."
  (when (and (org-export-derived-backend-p backend 'html)
             (string-match "h1 class=\"title\"" string))
    (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))

(add-to-list 'org-export-filter-final-output-functions

That's it!

Author: YangYingchao

上一篇     下一篇