Your patch may work in this particular case, but the idea behind htmlize is to describe the state of the buffer. If a property ends after the newline, it is intended that the generated HTML reflect
The philosophical question is then: Is the newline character part of the syntax construct that is being fontified, or rather a "formatting code" that should be kept separate?
Being whitespace it (mostly) doesn't matter visually, which makes it an easy choice to include in tokens to preserve formatting continuity between lines.
However, any further line processing by other modules is complicated significantly if the terminator is put inside the markup.
I am not familiar with org-mode, so I will need a description of exactly how to reproduce this bug. Specifically I don't know how to put a reference on the next line.
This Elisp will create/overwrite a buffer called foo.org in the /tmp directory containing problematic code and export it to foo.html:
(let ((filename (expand-file-name "foo.org" temporary-file-directory))) (switch-to-buffer (find-file-noselect filename)) (erase-buffer) (insert "* #+BEGIN_SRC emacs-lisp (let ((x 42)) ; meaning of l.u.e. (print x)) ; (ref:2) #+END_SRC") (save-buffer) (org-mode) (org-export-as-html nil)) -- Roland. _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode