I have been using an org-contrib package (ox-extra) to exclude certain headings upon export. It works by adding an "ignore" tag to whichever heading you want to ignore, exporting the content under the heading but not the heading itself. The only problem is there doesn't seem to be a way to apply this tag universally to all headings in a document. The normal method of putting "#+FILETAGS: ignore" at the top of the document doesn't seem to take effect when exported. Is there a way to get the exporter to recognize tag inheritance for "ignore"?

1 Answer 1


EDIT in response to the comments

If you would like to remove the headlines, but keep the outline intact, then as described in the The 'Advanced Export Configuration' section of the org manual, you can add a filter to the org-export-filter-headline-functions:

(defun my-html-headline-filter (text backend info)
  "Remove headlines from exported html."
  (when (eq backend 'html)
      (insert text)
      (goto-char (point-min))
      (flush-lines "^<h[0-9] id")

(add-to-list 'org-export-filter-headline-functions

The example filter function does not keep the links from the outline to the headlines intact, as the link id's are associated with the headlines. If you want to keep the link functionality intact, you would have to think about how you would like to adapt the html in order to do that. This however, is up to you to decide (it becomes an html/regexp question). If you decide how to implement the html part, then you can simply adapt the example filter function accordingly.

B.t.w., alternatively to this answer, you could also tinker directly with the org-html-headline function.


If I understand you correctly, you would like to remove (ignore) all headlines when exporting. The 'Advanced Export Configuration' section of the org manual starts with an example of how to achieve this.

Unfortunately, that example does not seem to work correctly here.

Fortunately, it is quite easy to invent an alternative function to remove headlines from an org document e.g. the following

(defun my-headline-removal (backend)
  "Remove all headlines in the current buffer.
BACKEND is the export back-end being used, as a symbol."
  (flush-lines "^*+ "))

After evaluating this function and adding it to the org-export-before-parsing-hook:

(add-hook 'org-export-before-parsing-hook #'my-headline-removal)

your headlines should be ignored on export.

If you only want to 'apply' this hook selectively, then you could define your own custom command instead of adding the function to the hook permanently as follows:

(defun my-custom-export ()
  (let ((org-export-before-parsing-hook (cons #'my-headline-removal

For this example I have used the function to export to markdown, but you can replace it with any other appropriate export function.

  • Thank you for this solution, but the most ideal result would be to ignore the headings for the export process without deleting them from the document, so the structure, or outline, of the document remains intact. This is what the ox-extra "ignore headlines" function does well. The only problem is the "ignore" tag cannot be inherited in other headings. Commented Nov 27, 2023 at 14:27
  • 2
    Although I understand now your 'additional wish', I would like to 'reword' your statements. This solution does not delete headings from the document, but it deletes it from the output. Also, are you sure that your statement about ox-extra keeping the outline intact is correct (i.e. can you find your ignored headings in the outline)? ;) Commented Nov 27, 2023 at 15:15
  • A solution that keeps the outline intact might still be possible, depending on which export backend you are using. E.g. for latex the outline is created from the outline in the latex document, so in that case it is not possible to fix it with elisp. Could you let us know which export backend(s) you are using? Commented Nov 27, 2023 at 15:48
  • Pardon, I read the answer wrong. :) I'm exporting to HTML. Commented Nov 27, 2023 at 15:55
  • I have updated the answer with a solution... Commented Nov 27, 2023 at 17:56

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.