BSD-3-Clause licensed by Deepak Jois
Maintained by [email protected]
This version can be pinned in stack with:blaze-svg-0.3.7@sha256:03143914266bc60a6deeba0ef9c4f6402e5c20f48d670beaa69135cf9ee13ca6,1855
Depends on 3 packages(full list with versions):
Used by 2 packages in nightly-2023-10-01(full list with versions):

blaze-svg uses blaze-markup to provide a SVG combinator library. blaze-markup is a fast combinator library which was derived from blaze-html.

Example Usage

Look at the examples in the Examples folder.

{-# LANGUAGE OverloadedStrings #-}
module Example where
import Text.Blaze.Svg11 ((!))
import qualified Text.Blaze.Svg11 as S
import qualified Text.Blaze.Svg11.Attributes as A
import Text.Blaze.Svg.Renderer.String (renderSvg)

main :: IO ()
main = do
  let a = renderSvg svgDoc
  putStrLn a

svgDoc :: S.Svg
svgDoc = S.docTypeSvg ! A.version "1.1" ! A.width "150" ! A.height "100" ! A.viewbox "0 0 3 2" $ do
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#008d46"
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#ffffff"
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#d2232c"

This produces the output below (formatted for readability)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="150" height="100" viewBox="0 0 3 2">
  <rect width="1" height="2" fill="#008d46" />
  <rect width="1" height=" 2" fill="#ffffff" />
  <rect width="1" height="2" fill="#d2232c" />
</svg>

Documentation

Changes

0.3.7 (6 June 2023)

  • Change maintainer to diagrams organization
  • Bug fix: make filter node a parent rather than a leaf (thanks to @jpnp)
  • Update and test to work with GHC 9.6

0.3.6.1 (13 March 2017)

  • Allow blaze-markup-0.8.

0.3.6 (25 January 2016)

  • Change to types of a, aa, and ar, to correct a semantic bug (see https://github.com/deepakjois/blaze-svg/pull/19). Technically this should require a major version bump, but since this only changes the types of new functions just introduced in 0.3.5, which no one is likely to be depending on yet, I judge it more prudent to avoid the trouble of forcing lots of upper bound bumps. As always, if this causes problems for you, just yell, and we can deprecate this version and do a proper 0.4 release.

0.3.5 (4 January 2016)

  • Added support for elliptical arcs (aa, ar)

0.3.4.1 (24 February 2015)

  • Allow blaze-markup-0.7

0.3.4 (21 May 2014)

  • export rotateAround

0.3.3.1 (3 February 2014)

  • Allow blaze-markup-0.6