SVG? Yes!

~165 words. ~0 minutes.

tags: emacs meta

This post by nwalsh shows how to use SVG in Org generated HTML pages. I would like to showcase yet another way you can use SVGs in Org generated HTML pages, and that is through Org Babel.

(let ((svg (svg-create 400 400 :stroke-width 10)))
  (svg-gradient svg "gradient1" 'linear '((0 . "red") (100 . "blue")))
  (svg-circle svg 200 200 100 :gradient "gradient1"
              :stroke-color "green")
  (with-temp-buffer
    (svg-print svg)
    (buffer-substring-no-properties (point-min) (point-max))))

These are the header arguments I used,

#+begin_src emacs-lisp :exports both :results html

I have been wanting to do some dynamically generated SVG images on my website, but I haven't gotten many ideas yet.

I currently only use this technique (without the SVG) for generating those colorful random dots on the homepage.

Author: tusharhero

emailreplace [at] with @, and put the domain for username, and vice versa: sdf.org [at] tusharhero

© tusharhero 2024-2025, check licenses page for details.

Date: 2025-10-20 Mon 11:18

Emacs 31.0.50 (Org mode 9.7.11)