1.0.0 • Published 8 months ago
html2obj-maciej v1.0.0
HTML to Object Parser
This JavaScript library allows you to parse HTML and convert it into a structured JavaScript object. It's designed to work both in Node.js and in the browser environment.
Installation
You can install this library via npm:
npm install jsdom
Run Command
node index.js markup.html
Usage
const fs = require("fs");
const parseHTML = require("html-to-object-parser");
const htmlObject = parseHTML(data);
API
parseHTML(html)
This function parses the given HTML string and returns an object representing the HTML structure.
html
: The HTML string to parse.
parseElement(element, Node)
This function recursively parses an HTML element into an object. It's used internally by parseHTML
.
element
: The HTML element to parse.Node
: The Node object from the window environment.
parseStyle(style)
This function parses the CSS style of an HTML element into an object. It's used internally by parseElement
.
style
: The CSS style of an HTML element.
1.0.0
8 months ago