Skip to content

Rich-Harris/svg-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published