Live data from Hacker News

An SVG is all you need

jon.recoil.org

31–40 of 155 posts

Re: An SVG is all you need

#31

My day job involves building dashboards, and SVGs have been invaluable for crisp icons and graphs... the portability across sizes is a blessing, but some of the more exotic filter effects still fail in certain browsers. ALSO I've run into security reviews that flag inline SVGs because they can embed scripts... would love to see more tooling to lint and sanitize them before deployment. BUT seeing a two-decade-old vect…

what dashboard software do you recommend?

Re: An SVG is all you need

#32
post #22

An SVG and JS, right? It's not interactive on its own.

The JS is embedded within the SVG file and not exposed outside it

Sort of... the SVG is referencing `svgscript.js` which is being fetched from the server (https://jon.recoil.org/blog/2025/12/svgscript.js)

Re: An SVG is all you need

#33
I agree with the author when they write:

""" In my idealistic vision of how scientific publishing should work, each paper would be accompanied by a fully interactive environment where the reader could explore the data, rerun the experiments, tweak the parameters, and see how the results changed. """

I do like seeing larger labs/companies releasing research full of SVGs. In recent memory, I quite liked this from NVIDIA:

https://research.nvidia.com/labs/dbr/blog/illustrated-evo2/

Re: An SVG is all you need

#34

This is going to really transform some data visualization things I've been thinking about. I've always loved SVG since working with Illustrator and Inkscape back in the day, but I didn't realize how much it could tie in with the modern web and interactivity. Thank you!

SVG has been transforming web-experiences (particularly for viz) for quite some time now, see:

- https://mlu-explain.github.io/neural-networks/

- https://www.nytimes.com/spotlight/graphics

- https://pudding.cool/

Re: An SVG is all you need

#35

My day job involves building dashboards, and SVGs have been invaluable for crisp icons and graphs... the portability across sizes is a blessing, but some of the more exotic filter effects still fail in certain browsers. ALSO I've run into security reviews that flag inline SVGs because they can embed scripts... would love to see more tooling to lint and sanitize them before deployment. BUT seeing a two-decade-old vect…

> would love to see more tooling to lint and sanitize them before deployment

Sanitisation is one of two possible defences, the other being script execution controls or sandboxing. E.g., if you serve vector images on a web server, set a Content Security Policy header¹ for all your images that simply denies all scripting. You can also run it from a dummy domain ('origin') with nothing valuable on it (like how domains such as googleusercontent.com and githubusercontent.com are being used)

For sanitisation, DOMPurify² is the only widely used and tested library that I know of. It could use more bindings for other languages but, if you can call into it, it can go in your deployment pipeline. (Disclosure: I've worked with some of the people at Cure53, but not on this project)

You can also combine the approaches for defence in depth

¹ https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP

² https://github.com/cure53/DOMPurify

Re: An SVG is all you need

#36
Around 15 years ago, I built a barbecue controller. This controller had four temperature probes that could be used to check the temperature of the inner cooking chamber as well as various cuts of meat. It controlled servos that opened and closed vents and had a custom derived PID algorithm that could infer the delayed effects of oxygen to charcoal.

Anyway, of relevance to this thread is that the controller connected to the local wireless network and provided an embedded HTTP server with an SVG based web UI that would graph temperatures and provided actual knobs and dials so that the controller could be tweaked. SVG in the browser works nicely with Javascript.

Re: An SVG is all you need

#37

Author here: I've just made a ninja edit of the post as it didn't really make clear a quite important point - the SVG is literally 20 years old, and still works, astonishingly. I'm not sure much else I wrote around the time would still work without some editing!

The reverse is kind of true: In the beginning, SVGs were not really an option since it lacked adoption across all major browsers, or more specifically its integration was very heterogenous.

So a SVG you authored 20 years ago for some browser will likely work everywhere today.

Re: An SVG is all you need

#38
I love working with SVGs.

We use SVGs on https://typequicker.com/press for the blog post hero images.

This way - even if the user changes themes, the colors of the image will be consistent with whatever theme is currently active. Also - the loading time is near-instant since we don't need to fetch the img file for the blog post image - just render the svg.

Re: An SVG is all you need

#39
I recently found out that it is surprisingly hard to convert an SVG file that consists of series of line segments into a list of those line segments in Python.

I tried with ChatGPT and Claude but both were not able to find a solution that respects the entire specification, especially transforms.

Initially, my expectation was that there must be a library for this kind of thing, but alas.

Re: An SVG is all you need

#40
Even though the article is mostly talking about visualizations, but I thought I'd share that I did at one point build a dance choreography software that renders the UI entirely SVG. I was surprised as to how well that worked.

If you're curious, it's called StageKeep, and you can find it here. https://stagekeep.com/

The original project used React Three Fiber, but refactored it to SVG for reasons I don't quite remember. I was inspired by signed distance functions, and the fact that one function could have such an outsized visual effect. Although the software doesn't use SDFs, but I like the idea of atomic functions that accepts some input, and outputs SVG.

Post reply on HN