Exporting Only the Contents of An Org Subtree

Here’s a short Org-mode tip that, although quite old, I just learned about. Suppose you want to export an Org subtree but you want only the contents and not the header. This emacs-reddit question, which alerted me to the solution, gives a typical use case for such a capability.

It turns out that there are lots of ways of doing this but the easiest is to require ox-extra as explained here. Once you’ve gotten the proper packages loaded and configured, you need only add an :ignore tag to the header that you don’t want to export. This differs from using the (typical) :noexport tag in that the contents will still be exported.

Notice that the package you need to install is org-plus-contrib not ox-extra. Also note that you’ll need to have the Org repository in your list of ELPA repositories. You can do that with something like

(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

if you don’t already have it included.

I haven’t needed something like this very often but it’s nice to know how to do it when I do have the need.

This entry was posted in General and tagged , . Bookmark the permalink.