org-replace-region-by-html Source Exerpted from org-html.el.
(defun org-replace-region-by-html (beg end) "Assume the current region has org-mode syntax, and convert it to HTML. This can be used in any buffer. For example, you could write an itemized list in org-mode syntax in an HTML buffer and then use this command to convert it." (interactive "r") (let (reg html buf pop-up-frames) (save-window-excursion (if (derived-mode-p 'org-mode) (setq html (org-export-region-as-html beg end t 'string)) (setq reg (buffer-substring beg end) buf (get-buffer-create "*Org tmp*")) (with-current-buffer buf (erase-buffer) (insert reg) (org-mode) (setq html (org-export-region-as-html (point-min) (point-max) t 'string))) (kill-buffer buf))) (delete-region beg end) (insert html)))