Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Rich-Harris/svg-parser


https://github.com/Rich-Harris/svg-parser

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# svg-parser

Take a string representing an SVG document or fragment, turn it into [HAST](https://github.com/syntax-tree/hast) JavaScript object.

## Installation

`npm install svg-parser`, or grab it from [npmcdn.com/svg-parser](https://npmcdn.com/svg-parser).

## Usage

```js
import { parse } from 'svg-parser';

const parsed = parse( `



` );
/*
{
type: 'root',
children: [
{
type: 'element',
tagName: 'svg',
properties: {
viewBox: '0 0 100 100'
},
children: [...]
}
]
}
*/
```

## License

MIT