diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## [v1.3.1.3](https://github.com/diagrams/diagrams-svg/tree/v1.3.1.2) (2015-07-09)
+
+- Changes to allow `lucid-svg-0.5`
+
 ## [v1.3.1.2](https://github.com/diagrams/diagrams-svg/tree/v1.3.1.2) (2015-05-26)
 
 [Full Changelog](https://github.com/diagrams/diagrams-svg/compare/v1.3.1.1...v1.3.1.2)
diff --git a/diagrams-svg.cabal b/diagrams-svg.cabal
--- a/diagrams-svg.cabal
+++ b/diagrams-svg.cabal
@@ -1,5 +1,5 @@
 Name:                diagrams-svg
-Version:             1.3.1.2
+Version:             1.3.1.3
 Synopsis:            SVG backend for diagrams drawing EDSL.
 Homepage:            http://projects.haskell.org/diagrams/
 License:             BSD3
@@ -38,6 +38,7 @@
 Library
   Exposed-modules:     Diagrams.Backend.SVG
                        Diagrams.Backend.SVG.CmdLine
+                       Diagrams.Backend.SVG.Attributes
   Other-modules:       Graphics.Rendering.SVG
   Hs-source-dirs:      src
   Build-depends:       base                 >= 4.3   && < 4.9
@@ -52,7 +53,7 @@
                      , diagrams-core        >= 1.3   && < 1.4
                      , diagrams-lib         >= 1.3   && < 1.4
                      , monoid-extras        >= 0.3   && < 0.5
-                     , lucid-svg            >= 0.4.0.3 && < 0.5
+                     , lucid-svg            >= 0.5   && < 0.6
                      , text                 >= 0.11  && < 1.3
                      , JuicyPixels          >= 3.1.5 && < 3.3
                      , split                >= 0.1.2 && < 0.3
@@ -61,6 +62,7 @@
                      , lens                 >= 4.0   && < 4.12
                      , hashable             >= 1.1   && < 1.3
                      , optparse-applicative >= 0.10  && < 0.12
+                     , semigroups           >= 0.13  && < 0.17
   if impl(ghc < 7.6)
     build-depends:     ghc-prim
 
diff --git a/src/Diagrams/Backend/SVG.hs b/src/Diagrams/Backend/SVG.hs
--- a/src/Diagrams/Backend/SVG.hs
+++ b/src/Diagrams/Backend/SVG.hs
@@ -255,7 +255,7 @@
   RPrim p                 -> render SVG p
   RStyle sty              -> R $ local (over style (<> sty)) r
   RAnnot (OpacityGroup o) -> R $ g_ [opacity_ $ toText o] <$> r
-  RAnnot (Href uri)       -> R $ a_ [xlinkHref_ $ toText uri] <$> r
+  RAnnot (Href uri)       -> R $ a_ [xlinkHref_ $ T.pack uri] <$> r
   _                       -> R r
   where
     R r = foldMap rtree rs
diff --git a/src/Diagrams/Backend/SVG/Attributes.hs b/src/Diagrams/Backend/SVG/Attributes.hs
new file mode 100644
--- /dev/null
+++ b/src/Diagrams/Backend/SVG/Attributes.hs
@@ -0,0 +1,64 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Diagrams.Backend.SVG.Attributes
+-- Copyright   :  (c) 2015 Diagrams team (see LICENSE)
+-- License     :  BSD-style (see LICENSE)
+-- Maintainer  :  diagrams-discuss@googlegroups.com
+--
+-- Attributes that are specific to the SVG backend. The intent
+-- of this module is to allow adding the attributes class,
+-- and id attributes to an SVG. For those embedding
+-- the resulting SVG into a webpage, this allows some
+-- interactivity with javascript and stylesheets.
+--
+-----------------------------------------------------------------------------
+
+module Diagrams.Backend.SVG.Attributes (
+  -- * Id
+    SvgId(..)
+  , svgId
+
+  -- * Class
+  , SvgClass(..)
+  , svgClass
+
+  ) where
+
+import         Diagrams.Core.Style (AttributeClass, HasStyle, applyAttr)
+import         Data.Semigroup
+import         Data.Typeable       (Typeable)
+
+-----------------------------------------------------------------
+--  Id
+-----------------------------------------------------------------
+
+-- | The SVG id attribute.
+newtype SvgId = SvgId {getSvgId :: String}
+  deriving Typeable
+
+instance Semigroup SvgId where
+  _ <> a = a
+instance AttributeClass SvgId
+
+-- | Set the Id attribute.
+svgId :: HasStyle a => String -> a -> a
+svgId = applyAttr . SvgId
+
+-----------------------------------------------------------------
+--  Class
+-----------------------------------------------------------------
+
+-- | The SVG class attribute.
+newtype SvgClass = SvgClass {getSvgClass :: String}
+  deriving Typeable
+
+instance Semigroup SvgClass where
+  _ <> a = a
+
+instance AttributeClass SvgClass
+
+-- | Set the class attribute.
+svgClass :: HasStyle a => String -> a -> a
+svgClass = applyAttr . SvgClass
diff --git a/src/Graphics/Rendering/SVG.hs b/src/Graphics/Rendering/SVG.hs
--- a/src/Graphics/Rendering/SVG.hs
+++ b/src/Graphics/Rendering/SVG.hs
@@ -5,6 +5,7 @@
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE RankNTypes        #-}
 {-# LANGUAGE ViewPatterns      #-}
+{-# LANGUAGE DeriveDataTypeable #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -69,6 +70,9 @@
 -- from JuicyPixels
 import           Codec.Picture
 
+-- from same package
+import Diagrams.Backend.SVG.Attributes       (SvgId(..),SvgClass(..))
+
 -- | Constaint on number type that diagrams-svg can use to render an SVG. This
 --   includes the common number types: Double, Float
 type SVGFloat n = (Show n, TypeableFloat n)
@@ -128,7 +132,7 @@
   defs_ $ clipPath_ [id_ (clipPathId ident)] (renderPath p)
   g_  [clip_path_ $ ("url(#" <> clipPathId ident <> ")")] svg
     where
-      clipPathId i = prefix <> "myClip" <> (toText i)
+      clipPathId i = prefix <> "myClip" <> (pack . show $ i)
 
 renderStop :: SVGFloat n => GradientStop n -> SvgM
 renderStop (GradientStop c v)
@@ -203,8 +207,10 @@
     where
       fillColorRgb     = Just $ colorToRgbText c
       fillColorOpacity = Just $ colorToOpacity c
-  Just (LG _) -> [fill_ ("url(#gradient" <> toText ident <> ")"), fill_opacity_ "1"]
-  Just (RG _) -> [fill_ ("url(#gradient" <> toText ident <> ")"), fill_opacity_ "1"]
+  Just (LG _) -> [fill_ ("url(#gradient" <> (pack . show $ ident)
+                                         <> ")"), fill_opacity_ "1"]
+  Just (RG _) -> [fill_ ("url(#gradient" <> (pack . show $ ident)
+                                         <> ")"), fill_opacity_ "1"]
   Nothing     -> []
 
 renderLineTextureDefs :: SVGFloat n => Int -> Style v n -> SvgM
@@ -221,8 +227,10 @@
     where
       lineColorRgb     = Just $ colorToRgbText c
       lineColorOpacity = Just $ colorToOpacity c
-  Just (LG _) -> [stroke_ ("url(#gradient" <> toText ident <> ")"), stroke_opacity_ "1"]
-  Just (RG _) -> [stroke_ ("url(#gradient" <> toText ident <> ")"), stroke_opacity_ "1"]
+  Just (LG _) -> [stroke_ ("url(#gradient" <> (pack . show $ ident)
+                                           <> ")"), stroke_opacity_ "1"]
+  Just (RG _) -> [stroke_ ("url(#gradient" <> (pack . show $ ident)
+                                           <> ")"), stroke_opacity_ "1"]
   Nothing     -> []
 
 dataUri :: String -> BS8.ByteString -> AttributeValue
@@ -240,8 +248,8 @@
 renderDImage (DImage _ w h tr) uridata =
   image_
     [ transform_ transformMatrix
-    , width_  (toText w)
-    , height_ (toText h)
+    , width_  (pack . show $ w)
+    , height_ (pack . show $ h)
     , xlinkHref_ uridata ]
   where
     [[a,b],[c,d],[e,f]] = matrixHomRep (tr `mappend` reflectionY
@@ -289,8 +297,19 @@
   , renderFontSlant
   , renderFontWeight
   , renderFontFamily
+  , renderSvgId
+  , renderSvgClass
   , renderMiterLimit ]
 
+
+renderSvgId :: SVGFloat n => Style v n -> [Attribute]
+renderSvgId s = renderTextAttr id_ svgIdAttr
+ where svgIdAttr = pack . getSvgId <$> getAttr s
+
+renderSvgClass :: SVGFloat n => Style v n -> [Attribute]
+renderSvgClass s = renderTextAttr class_ svgClassAttr
+ where svgClassAttr = pack . getSvgClass <$> getAttr s
+
 renderMiterLimit :: SVGFloat n => Style v n -> [Attribute]
 renderMiterLimit s = renderAttr stroke_miterlimit_ miterLimit
  where miterLimit = getLineMiterLimit <$> getAttr s
@@ -369,7 +388,7 @@
 
 -- | Render a style attribute if available, empty otherwise.
 renderAttr :: Show s => (AttributeValue -> Attribute) -> Maybe s -> [Attribute]
-renderAttr attr valM = maybe [] (\v -> [attr (toText v)]) valM
+renderAttr attr valM = maybe [] (\v -> [attr (pack . show $ v)]) valM
 
 renderTextAttr :: (AttributeValue -> Attribute) -> Maybe AttributeValue -> [Attribute]
 renderTextAttr attr valM = maybe [] (\v -> [attr v]) valM
@@ -382,7 +401,7 @@
   , int b
   , ")" ]
  where
-   int d     = toText (round (d * 255) :: Int)
+   int d     = pack . show $ (round (d * 255) :: Int)
    (r,g,b,_) = colorToSRGBA c
 
 colorToOpacity :: forall c . Color c => c -> Double
