While exporting following sample org file content to html, final output skips headings from 3rd depth in table of content.

After reading org documentation, and forum questions, I tried following, but still no luck in exporting all sub headings.

  1. Changed org-imenu-depth to 4
  2. Changed imenu-auto-rescan to a non-nil value
  3. Chanaged imenu auto rescan maxout to 600000 as file size is 400 KB.


* Head 1 shown
* Head 2 shown
** Head 2.1 shown
*** Head 2.3 not shown
* Head 3

Emacs version: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30

Org mode 9.1.9

  • 1
    Try inserting #+OPTIONS: H:3 at the top of the org file.
    – Tobias
    Commented Jun 13, 2019 at 15:22
  • Tried, but seems not working.
    – msinfo
    Commented Jun 13, 2019 at 15:25
  • What emacs version, what org-version, have you tried with emacs -Q and M-x package-initialize?
    – Tobias
    Commented Jun 13, 2019 at 15:27
  • 1
    What is the value of org-export-headline-levels? Note, that org-export has (AFAIK) nothing to do with imenu. Pitingly, that means that all your attempts are pointless with respect to html export. You can start emacs -Q from within emacs. Just use M-& emacs -Q. This is just for testing. (So you do not need the runemacs stuff. Just ignore the additional Windows window.) After starting up Emacs run M-x package-initialize and afterwards do your tests.
    – Tobias
    Commented Jun 13, 2019 at 15:50
  • 1
    @msinfo: those references to imenu (and imenu in general, as @Tobias points out) have nothing to do with HTML export
    – NickD
    Commented Jun 13, 2019 at 17:26

1 Answer 1


org-export-headline-levels is the option determining up to which level headlines are included in the table of contents of the exported document.

The standard value of org-export-headline-levels in Orgmode 9.1.9 is 3.

I tested your example org file with this standard setting and Head 2.3 was also included in the table of contents. That indicates that you have customized org-export-headline-levels to a lower value in your configuration.

You can easily increase the default value for org-export-headline-levels with M-x customize-option RET org-export-headline-levels RET.

All org documents will work with this default value if you do not set the value of org-export-headline-levels explicitly in the document.

You can set the value explicitly locally for one org document with a line like the following:


Adapt the value 5 to your likings.

Equivalently you can set the option as file local variable:

  1. Either use the following first line for the org file:
    # -*- org-export-headline-levels: 5 -*-

  2. or append the following section to your org file. It does not hurt since it is excluded from export.

    * Local Variables :noexport:
    Local Variables:
    org-export-headline-levels: 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.