{"id":18496198,"url":"https://github.com/thecoderdream/html-parser","last_synced_at":"2025-10-24T22:38:55.342Z","repository":{"id":194088804,"uuid":"690010333","full_name":"TheCoderDream/html-parser","owner":"TheCoderDream","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-11T15:59:42.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T22:38:54.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCoderDream.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-11T11:10:27.000Z","updated_at":"2023-09-11T15:03:30.000Z","dependencies_parsed_at":"2023-09-11T17:54:32.672Z","dependency_job_id":"af2b1415-478a-4360-ac22-b9d2b826bb8b","html_url":"https://github.com/TheCoderDream/html-parser","commit_stats":null,"previous_names":["thecoderdream/html-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheCoderDream/html-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCoderDream%2Fhtml-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCoderDream%2Fhtml-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCoderDream%2Fhtml-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCoderDream%2Fhtml-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCoderDream","download_url":"https://codeload.github.com/TheCoderDream/html-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCoderDream%2Fhtml-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280878344,"owners_count":26406641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T13:28:23.398Z","updated_at":"2025-10-24T22:38:55.316Z","avatar_url":"https://github.com/TheCoderDream.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# symbols-html-parser\n\n## Description\n\n`symbols-html-parser` is a JavaScript library that allows you to parse HTML into a structured object format. It provides a way to convert HTML markup into a tree-like structure, making it easier to work with and manipulate HTML content programmatically.\n\n## Installation\n\nTo install `symbols-html-parser`, you can use npm:\n\n```bash\nnpm install symbols-html-parser\n```\n\n## Usage\n\nTo use symbols-html-parser, import it into your JavaScript or TypeScript code:\n\n```javascript\nconst { parseHtml } = require('symbols-html-parser/dist'); // For CommonJS\n// or\nimport { parseHtml } from 'symbols-html-parser/dist'; // For ES Modules\n```\n\n### To parse an HTML file using the command line interface (CLI), run the following command:\n```bash\nnode symbols-html-parser/dist/main.js example.html\n```\n## Parsing HTML\nYou can parse HTML content using the parseHtml function:\n\n```javascript\nconst html = `\n\u003cdiv style=\"background-color: yellow; font-size: 14px\" id=\"first-div\"\u003e\n    Hello, friends\n    \u003cp class=\"para\" style=\"font-faimly: monospace; font-size: 11px\"\u003e\n        Lorem ipsum dolor sit\n    \u003c/p\u003e\n    \u003cfooter style=\"width: auto; height: 100px; color: blue\"\u003e\n        \u003cspan\u003e\n            This is the end\n        \u003c/span\u003e\n    \u003c/footer\u003e\n\u003c/div\u003e`;\nconst parsedHtml = parseHtml(html);\nconsole.log(parsedHtml);\n```\n\nThe `parseHtml` function takes an HTML string as input and returns a structured object representing the HTML content.\n\n## Example Output\nHere's an example of the output structure:\n\n```javascript\n{\n  tag: 'div',\n  text: 'Hello, friends',\n  style: {\n    backgroundColor: 'yellow',\n    fontSize: '14px'\n  },\n  id: 'first-div',\n  children: [{\n    tag: 'p',\n    text: 'Lorem ipsum dolor sit',\n    class: 'para',\n    style: {\n      fontFamily: 'monospace',\n      fontSize: '11px',\n    }\n  }, {\n    tag: 'footer',\n    style: {\n      width: 'auto',\n      height: '100px',\n      color: 'blue',\n    },\n    children: [{ tag: 'span', text: 'This is the end' }]\n  }]\n}\n```\n\n## Using symbols-html-parser in a Browser\nsymbols-html-parser can be used in a web browser environment just like any other JavaScript library. To use it, you'll need to include the library in your HTML file and use it in your client-side JavaScript code. Here's a step-by-step guide on how to do that:\n\n## Step 1: Include the Library\nInclude the symbols-html-parser library in your HTML file using a script tag. You can host the library on a CDN or include it from a local file. Here's an example using a CDN:\n\nNote: I am going to deploy to CDN later\n```html\n\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/symbols-html-parser/dist/main.js\"\u003e\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecoderdream%2Fhtml-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecoderdream%2Fhtml-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecoderdream%2Fhtml-parser/lists"}