1.1.3 • Published 8 months ago

html-objectifier v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

html-objectifier

This Node.js package allows you to effortlessly convert HTML markup into a structured JavaScript object. It's a versatile library that can be used in both Node.js applications and browser environments. Whether you need to process HTML from files or input via a textarea, this library has you covered.

Features

  • Parse HTML markup into a nested object structure.
  • Extract tag names, attributes, text content, and styles.
  • Handle complex nested HTML elements and structures.
  • Designed for ease of use with CLI and browser input support.
  • Highly customizable with options for parsing and formatting.

Installation

You can install this package using npm or yarn:

npm install html-objectifier
# or
yarn add html-objectifier

Usage

  1. Import the library in your Node.js application:
//index.js

const html_objectifier = require("html-objectifier");
html_objectifier();
  1. You can run it as CLI by running node index.js markup.html

  2. Use the library to convert HTML to an object:

const html = "<div><p>Hello, World!</p></div>";
const result = html_objectifier.parseHTML(html);
console.log(JSON.stringify(result));

For browser usage, include the library via a script tag and use it in your JavaScript code.

<script src="https://cdn.jsdelivr.net/gh/byteballet/html-objectifier@master/dist/bundled.js"></script>
<script>
  const { parseHTML } = html_objectifier;
  console.log(parseHTML('<!DOCTYPE html><html lang="en"></html>'));
</script>

Contributions

Contributions and feedback are welcome! If you have suggestions, bug reports, or want to contribute code, please open an issue or submit a pull request.

License

This package is open-source.

Author

Byte Ballet

Contact

For inquiries, Talk to Me!.

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago