Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get htmlize.el work for project publishing in Emacs org-mode?

I want to publish a project in Emacs org-mode, which contains several .html files. There are some python code examples in them that I wanna highlight. But htmlize.el won't do that for me. Strangely, when exporting single .html file (using C-c C-e h), the code examples are highlighted . So how could I get htmlize.el work for project publishing?

like image 620
dofine Avatar asked Dec 03 '10 03:12

dofine


2 Answers

In your org-publish-project-alist, set the htmlized-source property to non-nil:

(setq org-publish-project-alist
      '(("my-project"
           :base-directory ...
           :htmlized-source t
             ...
       )))

See the Publishing action section of the Org-mode manual.

like image 114
Dave Bacher Avatar answered Nov 18 '22 06:11

Dave Bacher


You have to put your code inside #+BEGIN_SRC and #+END_SRC . For example

* My python code
#+BEGIN_SRC python
def foo():
  if bar == 1:
     bar = 2
  else: 
     bar = 3
#+END_SRC
like image 3
Oleg Pavliv Avatar answered Nov 18 '22 05:11

Oleg Pavliv