Skip to content

xml editor - d tag styling

Summary:

d is probably one of the most important tag for paths it stores data about a shape. It would be really nice if we could improve the readability of this tag in XML editor

before after
image image

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d SVG defines 6 types of path commands, for a total of 20 commands:

command number of attributes syntax
MoveTo: M, m 2 M x,y m dx,dy
LineTo: L, l, H, h, V, v 1-2 L x,y l dx,dy H dx h x V dx v x
Cubic Bézier Curve: C, c, S, s 4-6 C x1,y1, x2,y2, x,y c dx1,dy1 dx2,dy2 dx,dy S x2,y2, x,y s dx2,dy2, dx,dy
Quadratic Bézier Curve: Q, q, T, t 2-4 Q x1,y1 x,y q dx1,dy1 dx,dy T x,y t dx,dy
Elliptical Arc Curve: A, a 6 A rx,ry angle,large-arc-flag,sweep-flag x,y a rx,ry angle,large-arc-flag,sweep-flag dx,dy
ClosePath: Z, z 0 _command_ z _command_ Z

Syntax:

  • every command should start in its own line (except for z, Z ?)
  • if there is no explicit command writhen it also should start in its own line

C x1,y1 x2,y2

x1,y1 x2,y2

  • attributes that belong together logically/categorically should be separated by ,. for example M x,y
  • next category of coordination should be separated by space character for example C x1,y1 x2,y2
  • every category should be color-coded
Edited by Adam Belis
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information