svg-parser (2.0.4)

Published 2026-02-24 14:05:58 +00:00 by atheaadmin

Installation

registry=
npm install svg-parser@2.0.4
"svg-parser": "2.0.4"

About this package

svg-parser

Take a string representing an SVG document or fragment, turn it into HAST JavaScript object.

Installation

npm install svg-parser, or grab it from npmcdn.com/svg-parser.

Usage

import { parse } from 'svg-parser';

const parsed = parse( `
	<svg viewBox='0 0 100 100'>
		<!-- stuff goes here... -->
	</svg>
` );
/*
{
  type: 'root',
  children: [
    {
      type: 'element',
      tagName: 'svg',
      properties: {
        viewBox: '0 0 100 100'
      },
      children: [...]
    }
  ]
}
*/

License

MIT

Dependencies

Development Dependencies

ID Version
@rollup/plugin-buble ^0.21.0
@rollup/plugin-node-resolve ^7.0.0
eslint ^3.2.2
locate-character ^2.0.5
mocha ^3.0.1
prettier ^1.18.2
rollup ^1.29.0
source-map-support ^0.4.2

Keywords

SVG parser JSON object
Details
npm
2026-02-24 14:05:58 +00:00
1
Rich Harris
MIT
latest
8.1 KiB
Assets (1)
Versions (1) View all
2.0.4 2026-02-24