{"id":16157200,"url":"https://github.com/thecolaber/text2html","last_synced_at":"2025-04-07T01:24:50.056Z","repository":{"id":56017423,"uuid":"313350623","full_name":"TheColaber/Text2HTML","owner":"TheColaber","description":"Takes text and inserts it into the page as HTML. Pure JS.","archived":false,"fork":false,"pushed_at":"2021-01-18T01:57:59.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T06:47:33.617Z","etag":null,"topics":["html","inserts","javascript","js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/TheColaber.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}},"created_at":"2020-11-16T15:46:11.000Z","updated_at":"2021-02-23T00:20:59.000Z","dependencies_parsed_at":"2022-08-15T11:31:08.531Z","dependency_job_id":null,"html_url":"https://github.com/TheColaber/Text2HTML","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheColaber%2FText2HTML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheColaber%2FText2HTML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheColaber%2FText2HTML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheColaber%2FText2HTML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheColaber","download_url":"https://codeload.github.com/TheColaber/Text2HTML/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247575476,"owners_count":20960780,"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","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":["html","inserts","javascript","js"],"created_at":"2024-10-10T01:48:49.363Z","updated_at":"2025-04-07T01:24:50.032Z","avatar_url":"https://github.com/TheColaber.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text2HTML - PLEASE REPORT BUGS\n\n## Info\n\nTakes text and parces it with your desired options. Useful when not wanting to use DOM Parsers, insertAdjentHTML, and innerHTML.\n\n#### Syntax:\n\n```js\nparseHTML(String text, Object options {| Boolean asList, String baseUrls |} )\n```\n\n- text - text to parse\n- options\n  - asList - return data as a list of Nodes. defaults to false.\n  - baseUrls - change the base urls in src and href attributes. defaults to \"\".\n\n#### Example:\n\n```js\ndocument.querySelector(\".main\").append(\n  ...parseHTML(\n    `\n  \u003cdiv class='nav'\u003e\n  \u003c!-- Welcome to Google! --\u003e\n    \u003ca href=https://google.com\u003e\n      \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg\" /\u003e\n    \u003c/a\u003e\n      Welcome!\n      \u003cbr\u003e\n      Google!\n  \u003c/div\u003e\n\n  \u003cstyle\u003e\n    body{\n      margin: 0;\n      color: white;\n      font-size: 60px;\n      letter-spacing: 2px;\n      line-height: 60px;\n      font-family: system-ui;\n    }\n\n    .nav{\n      width: 100%;\n      height: 300px;\n      background-color: #2b2b2b;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n    }\n\n    a img{\n      height: 150px;\n    }\n  \u003c/style\u003e\n\n  \u003cscript\u003e\n    let a = document.querySelector(\"a\");\n    a.addEventListener(\"click\", function (e) {\n      if (!confirm(\"Are you sure you would like to visit google?\")) {\n        e.cancelBubble = true;\n        e.preventDefault();\n      }\n    });\n  \u003c/script\u003e\n`,\n    { asList: true }\n  )\n);\n```\n\n## Supports\n\nThis function supports the following:\n\n- Elements\n  - Scripts\n  - Styles\n  - Self-closing\n  - Attributes\n    - Single quotes\n    - Double quotes\n    - No quotes\n    - No value attributes\n- Comments\n- Text Nodes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecolaber%2Ftext2html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecolaber%2Ftext2html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecolaber%2Ftext2html/lists"}