Irina Glushko 2389e7160b HW1 done | 3 years ago | |
---|---|---|
.. | ||
dist | 3 years ago | |
CHANGELOG.md | 3 years ago | |
README.md | 3 years ago | |
package.json | 3 years ago |
Take a string representing an SVG document or fragment, turn it into HAST JavaScript object.
npm install svg-parser
, or grab it from npmcdn.com/svg-parser.
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: [...]
}
]
}
*/
MIT