emacsorphanage / org-page

[INACTIVE] A static site generator based on Emacs and org mode.
673 stars 99 forks source link

Source Code Hightlighting #88

Closed sillykelvin closed 10 years ago

sillykelvin commented 10 years ago

Org-export uses htmlize.el to hightlight code blocks, as it depends on Emacs' theme, so it is a little annoying: if the theme changes, all color will change, and those files contain source code blocks will change, and a git commit is needed, though there is no actual useful content change!

Consider using google prettify.js instead.

sillykelvin commented 10 years ago

Implemented, the theme of source code block is Solarized Dark by default.

kit1980 commented 9 years ago

I'd like to use htmlize.el to hightlight, not a JavaScript library.

Is it still possible with recent org-page?

sillykelvin commented 9 years ago

Yeah, it is possible, but there is not a config item like (setq highlight-renderer 'js/'htmlize) to do this, you should:

  1. remove the JavaScript library from the theme template
  2. check the commit related to this issue, revert the changes made to op-template.el (just a few lines).

However, I strongly recommend using JavaScript library to do highlight job instead of htmlize.el:

  1. it will highlight the code during loading but not inject so many ugly html tags statically into source code.
  2. if you change the theme of Emacs, the generated files will remain unchanged, but htmlize.el will change all your generated html files even only contain one line of code.

Do you have any special reason for using htmlize.el instead of a highlighting JavaScript library?

kit1980 commented 9 years ago

I've "solved" it for myself by copying old op/render-content function to my init.el

My reasons for using htmlize.el:

sillykelvin commented 9 years ago

Now there is a variable to control this behavior: op/highlight-render, thanks to @CodeFalling's contribution!