4

Is it possible to get syntax highlight for HTML code within a #+BEGIN_EXPORT HTML environment block in org-mode?

I know it is possible to highlight HTML within a #+BEGIN_SRC block using ob-browser. Is there a way to "extend" such highlighting to other blocks as well?

  • 1
    It sounds like this might not be exactly what you want, but if you set (setq org-src-fontify-natively t) in your config, then html in a #+BEGIN_SRC html block should have highlighting. There is a nice setup here for dealing with org-mode source code blocks: github.com/danielmai/.emacs.d/blob/master/… – elethan Dec 10 '15 at 2:36
  • Yp, within #+BEGIN_SRC is not a problem... I was wondering about #+BEGIN_HTML. But thanks for the link – dangom Dec 10 '15 at 9:37
3

The problem lies on the arbitrariness with which Org Mode deals with case sensitivity. I was used to having a #+BEGIN_HTML block in Org Mode 8, and that didn't trigger the syntax highlighting. Had I used lowercases as in #+begin_html, things might have looked different.

Now, with Org Mode 9, one can get HTML highlight with any of:

#+begin_export html
<div>  
</div>
#+end_export

#+BEGIN_EXPORT html
<div>  
</div>
#+END_EXPORT

But not with:

#+BEGIN_EXPORT HTML
<div>  
</div>
#+END_EXPORT

Here's a screenshot:

html_highlighting

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.