1

As you're all probably aware, when you export a document from Org mode to HTML, the resulting file contains extra <div> and </div> items around each heading. In some cases these are very helpful, but is there a way to optionally exclude these additional HTML elements for a cleaner output?

1
1

You can use ox-slimhtml, an alternative HTML exporter. It produces minimalistic HTML output and in particular does not wrap each heading in a div.

1
  • Thank you for alerting me to this package. It comes very close to answering my question, but unfortunately creates some of its own issues. For example, it seems to wrap the whole output in its own div, even on a body only export. Very interesting though, thank you. May 4 at 18:20
1

advice is the magic to solve many Emacs problems,

(defun my-org-export-as-hack (orig-func &rest args)
  (let* ((result (apply orig-func args))
         (backend (nth 0 args)))
    (when (eq backend 'html)
      ;; use `replace-regexp-in-string' to process exported result
      (message "result=%s" result))
    result))
(advice-add 'org-export-as :around #'my-org-export-as-hack)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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