如何在org-mode HTML导出中禁用自动标题包含?

tro*_*ine 9 emacs org-mode

我有一个包含许多小组织文件的组织模式项目,我想将其导出为HTML.我没有设置#+TITLE很多文件,因为他们没有合适的标题.我在导出时发现部分第一句被导出为文档的标题.

例如,组织文件如下:

This is a short file.

Mary had a little lamb, etc.
Run Code Online (Sandbox Code Playgroud)

将导出为具有以下HTML:

*snip*
<div id="content">
<h1 class="title">This is a short file.</h1>


<p>Mary had a little lamb, etc.</p>
*snip*
Run Code Online (Sandbox Code Playgroud)

我希望看到上面文件中的两个句子都标记为段落.如何禁用标题的自动占卜?

N.N*_*.N. 8

要避免第一行成为标题,您可以设置一个空标题:

#+Title:

This is a short file.

Mary had a little lamb, etc.
Run Code Online (Sandbox Code Playgroud)


Ole*_*liv 5

如果您查看代码,org-export-region-as-html您将看到以下片段

(title (or (and subtree-p (org-export-get-title-from-subtree))
           (plist-get opt-plist :title)
           (and (not
                 (plist-get opt-plist :skip-before-1st-heading))
                (org-export-grab-title-from-buffer))
           (and buffer-file-name
                (file-name-sans-extension
                 (file-name-nondirectory buffer-file-name)))
           "UNTITLED"))
Run Code Online (Sandbox Code Playgroud)

org-export-grab-title-from-buffer如果没有定义标题,则调用函数.您可以通过禁用此功能建议

(defadvice org-export-grab-title-from-buffer (around org-export-grab-title-from-buffer-disable activate))
Run Code Online (Sandbox Code Playgroud)

  • 您可以告诉组织模式没有标题然后它将没有标题.你不需要破解它. (2认同)