[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Displaying Pretty fontification of source code blocks

From: Rodolfo Aramayo
Subject: Re: [O] Displaying Pretty fontification of source code blocks
Date: Sun, 9 Dec 2012 21:44:47 -0600

Here we go...
No I am NOT using my own CSS but the one generated by htmlize.el itself
First picture demo that my emacs is loading clean
Second picture is how I see the file



On Sun, Dec 9, 2012 at 9:33 PM, Jambunathan K <address@hidden> wrote:
Rodolfo Aramayo <address@hidden> writes:

> Hi,
> I have downloaded the org-source file corresponding to:
> http://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.
> html
> Installed color-theme-leuven.el
> Opened the file in emacs and exported as html
> Despite my best efforts I cannot make the file display the pretty
> color I see in the web site for the emacs-lisp code block
> The emacs-lisp code blocks seems to be properly displayed in emacs (I
> can see blus and green fonts) but never in the html file

Screenshot of your Emacs frame and HTML file please.

I suspect that the problem is with css.  Also tell if you are using your
own CSS for code blocks or the one generated by htmlize.el itself.

There is a bug whereby Emacs default fg/bg (one or both) don't get
passed on to exported HTML file.  This has been around for a long time.
But nobody has complained yet and I am surprised.

> Ideas?
> Thanks


Pretty fontification of source code blocks

Table of Contents

1 Description

This article is some "theming guide" about customizing the look and feel of an Org-Babel buffer inside Emacs. We'll show you how you can improve the appearance of source code blocks.

2 Screenshot

Screenshot for the Leuven theme (light theme, i.e. with a white background):


To configure "native fontification" (as in the above screenshot), set the following in your .emacs file:

;; fontify code in code blocks
(setq org-src-fontify-natively t)

3 Configuration File

  • To get the above full contributed theme, please visit Installing Org Color themes and copy the file color-theme-leuven.el in your load-path.
  • If you want to keep your existing Emacs color theme, and you only want to customize the "delimiter lines" of the code blocks, either:
    • Add the following lines to your current color theme:
       ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
       ((t (:background "#FFFFEA"))))
       ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
    • Define these faces, in your .emacs file, before requiring Org (if you don't have your own color theme):
      (defface org-block-begin-line
        '((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))
        "Face used for the line delimiting the begin of source blocks.")
      (defface org-block-background
        '((t (:background "#FFFFEA")))
        "Face used for the source block background.")
      (defface org-block-end-line
        '((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))
        "Face used for the line delimiting the end of source blocks.")

4 Further extensions

When we will have some spare time, our intention is to get the reserved keywords of Org-Babel (such as :var and :exports) somehow highlighted. Stay tuned – or give some help!

Date: 2012-01-25

Author: Sebastien Vauban

Org version 7.8.11 with Emacs version 24

Validate XHTML 1.0

Attachment: Screen shot 2012-12-09 at 9.39.28 PM.png
Description: PNG image

Attachment: Screen shot 2012-12-09 at 9.40.42 PM.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]