Skip to content

html-vschema creates a simplified and manipulable schema of html.

License

Notifications You must be signed in to change notification settings

aykutkardas/html-vschema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-vschema

html-vschema creates a simplified and manipulable schema of html.

Usage

<html>
  <body>
    <h1 class="text-2xl font-bold">HTML VSchema</h1>
  </body>
</html>
const schema = getSchema(document.body);
{
  "tagName": "body",
  "attributes": {},
  "children": [
    {
      "tagName": "h1",
      "attributes": {
        "class": "text-2xl font-bold"
      },
      "children": [
        {
          "text": "HTML VSchema"
        }
      ]
    }
  ]
}

With Options

ref

const schema = getSchema(document.body, { ref: true });
{
  "ref": Element
  "tagName": "body",
  "attributes": {},
  "children": [
    {
      "ref": Element,
      "tagName": "h1",
      "attributes": {
        "class": "text-2xl font-bold"
      },
      "children": [
        {
          "ref": Text,
          "text": "HTML VSchema"
        }
      ]
    }
  ]
}

ignoreTags

const schema = getSchema(document.body, { ignoreTags: ["h1"] });
{
  "tagName": "body",
  "attributes": {},
  "children": []
}

About

html-vschema creates a simplified and manipulable schema of html.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published