diff --git a/Highlight.hs b/Highlight.hs
--- a/Highlight.hs
+++ b/Highlight.hs
@@ -129,7 +129,7 @@
     then putStrLn $ renderHtml fragment
     else putStrLn $ renderHtml $ H.head (pageTitle >> metadata >> css) >> H.body (toHtml fragment)
   where fragment = formatHtmlBlock opts $ highlightAs lang code
-        css = styleToHtml sty
+        css = H.style ! A.type_ "text/css" $ toHtml $ styleToCss sty
         pageTitle = H.title $ toHtml fname
         metadata = H.meta ! A.httpEquiv "Content-Type" ! A.content "text/html; charset=UTF-8" >>
                     H.meta ! A.name "generator" ! A.content "highlight-kate"
diff --git a/Text/Highlighting/Kate.hs b/Text/Highlighting/Kate.hs
--- a/Text/Highlighting/Kate.hs
+++ b/Text/Highlighting/Kate.hs
@@ -17,13 +17,15 @@
 > import Text.Blaze.Renderer.String (renderHtml)
 > import Text.Blaze (toHtml)
 > import Text.Blaze.Html5 as H
+> import Text.Blaze.Html5.Attributes as A
 >
 > main = do
 >   code <- getContents
 >   putStrLn $ renderHtml
->            $ do H.head (styleToHtml tango)
+>            $ do H.head $ H.style ! A.type_ (toValue "text/css")
+>                        $ toHtml $ styleToCss tango
 >                 H.body $ toHtml
->                        $ formatBlock defaultFormatOpts
+>                        $ formatHtmlBlock defaultFormatOpts
 >                        $ highlightAs "ruby" code
 
 -}
diff --git a/Text/Highlighting/Kate/Format/HTML.hs b/Text/Highlighting/Kate/Format/HTML.hs
--- a/Text/Highlighting/Kate/Format/HTML.hs
+++ b/Text/Highlighting/Kate/Format/HTML.hs
@@ -11,7 +11,7 @@
 -}
 
 module Text.Highlighting.Kate.Format.HTML (
-      formatHtmlInline, formatHtmlBlock, styleToHtml
+      formatHtmlInline, formatHtmlBlock, styleToCss
    ) where
 import Text.Highlighting.Kate.Types
 import Text.Blaze
@@ -88,11 +88,9 @@
                               >> toHtml "\n"
                         else toHtml $ show n ++ "\n"
 
--- | Returns an HTML @style@ block with definitions for
--- formatting highlighted code according to the given style.
-styleToHtml :: Style -> Html
-styleToHtml f = H.style ! A.type_ (toValue "text/css") $ toHtml
-  $ unlines $ tablespec ++ colorspec ++ map toCss (tokenStyles f)
+-- | Returns CSS for styling highlighted code according to the given style.
+styleToCss :: Style -> String
+styleToCss f = unlines $ tablespec ++ colorspec ++ map toCss (tokenStyles f)
    where colorspec = case (defaultColor f, backgroundColor f) of
                           (Nothing, Nothing) -> []
                           (Just c, Nothing)  -> ["pre, code { color: " ++ fromColor c ++ "; }"]
@@ -123,5 +121,4 @@
         weightspec = if tokenBold tf then "font-weight: bold; " else ""
         stylespec  = if tokenItalic tf then "font-style: italic; " else ""
         decorationspec = if tokenUnderline tf then "text-decoration: underline; " else ""
-
 
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+highlighting-kate 0.5 (25 Jan 2012)
+
+  * Text.Highlighting.Kate.Format.HTML now exports styleToCss
+    instead of styleToHtml.
+
 highlighting-kate 0.4 (21 Jan 2012)
 
   * Text.Highlighting.Kate.Definitions has been renamed as
diff --git a/highlighting-kate.cabal b/highlighting-kate.cabal
--- a/highlighting-kate.cabal
+++ b/highlighting-kate.cabal
@@ -1,5 +1,5 @@
 Name:                highlighting-kate
-Version:             0.4
+Version:             0.5
 Cabal-Version:       >= 1.6
 Build-Type:          Simple
 Category:            Text
