3 ms·
Nice experiment. I wonder how often do people write SVG by hand? If often then it's definietly a good idea to simplify SVG/XML for writing. I once experiment
by djedr 4y ago
Nice experiment.
I wonder how often do people write SVG by hand?
If often then it's definietly a good idea to simplify SVG/XML for writing.
I once experimented with some extremely minimal formats[1] built on Jevko[2] (I am its father) particularly aimed at compacting SVG. For example:
svg width[391] height[391] viewBox[-70.5 -70.5 391 391] xmlns[http://www.w3.org/2000/svg] xmlns:xlink[http://www.w3.org/1999/xlink][
rect fill[#fff] stroke[#000] x[-70] y[-70] width[390] height[390]
g opacity[0.8][
rect x[25] y[25] width[200] height[200] fill[lime] stroke-width[4] stroke[pink]
circle cx[125] cy[125] r[75] fill[orange]
polyline points[50,150 50,200 200,200 200,100] stroke[red] stroke-width[4] fill[none]
line x1[50] y1[50] x2[200] y2[200] stroke[blue] stroke-width[4]
]
]
Compared to CSS-like syntax like in the post, the advantage of this is that it is extremely simple and generic, as it works for XML in general (especially the more minimal flavors, e.g. [3]).
There are no specialized features here but also not many parsing challenges or edge cases.
Clearly, there are ways to simplify these things, but not many people seem to be really interested in that.
[1] https://github.com/jevko/markup-experiments#asttoxml7 https://github.com/jevko/markup-experiments#asttoxml7
[2] https://jevko.org/ https://jevko.org/
[3] https://github.com/jevko/markup-experiments#asttoxml5 https://github.com/jevko/markup-experiments#asttoxml5
- doomrobo 4y ago> I wonder how often do people write SVG by hand? A data point: The New York Public Library just did their fourth SVG study group earlier this month. The description was "This group is studying Scalable Vector Graphics, images which can be composed in text editors like Notepad, as a way for Blind and low-vision people to create our own drawings or work with existing images. Feel free to join us if you're interested in drawing with code."
- cpach 4y agoFascinating. Is there any more info online about the study group?
- doomrobo 4y agoUnfortunately that was all the info I have. It was through the workshop newsletter that the library maintains. More info on workshops and how to subscribe: https://www.nypl.org/about/locations/heiskell/news https://www.nypl.org/about/locations/heiskell/news
- cpach 4y agoOk, cool. Very interesting use case IMHO. Never thought about SVG from that perspective before.