parseSvgPath function

Path parseSvgPath(
  1. String d
)

Parses an SVG path d string into a Path.

Supports the full SVG path command set that appears in KaTeX's svgGeometry data: move (M/m), line (L/l, H/h, V/v), cubic Bézier (C/c, S/s), quadratic Bézier (Q/q, T/t), elliptical arc (A/a), and close (Z/z), in both absolute (uppercase) and relative (lowercase) forms, including the SVG implicit-repeat rule (extra coordinate sets after a command repeat it; extras after M/m are treated as L/l). Numbers may be separated by whitespace and/or commas, may omit the leading 0 (.5), and may pack a sign as a separator (1-2).

Exposed (non-private) so it can be unit-tested directly.

Implementation

Path parseSvgPath(String d) {
  return _SvgPathParser(d).parse();
}