I have a section of an org-file where there are only headings with no content within them, each line is a (sub)heading.

* heading 1
* heading 2
** heading 2.1
** heading 2.2
*** heading 2.2.1
* heading 3

I want to put the point at a subtree, type a command, and have a buffer open up with (or copy to clipboard) that subtree converted to HTML. Not to a whole HTML file with <html>, <body>, styles, etc., just a short snippet like

  <li>heading 1</li>
    heading 2
      <li>heading 2.1</li>
        heading 2.2
          <li>heading 2.2.1</li>
  <li>heading 3</li>

Basically remove the *s and mimic the tree structure in HTML, no need to process anything beyond that like turning /italics/ into <em>s or anything like that.

Is there something ready that does that, or how would I go about doing it in Emacs Lisp?

  • It's possible to restrict exporting to a subtree and export nothing but the body, so you could write an export backend that could output an HTML list like this one.
    – user12563
    Jan 6, 2018 at 15:33


Your Answer

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

Browse other questions tagged or ask your own question.