{"id":23366744,"url":"https://github.com/d8corp/innet-html","last_synced_at":"2025-04-07T23:15:44.163Z","repository":{"id":57118739,"uuid":"461520200","full_name":"d8corp/innet-html","owner":"d8corp","description":"Convert jsx elements into html text","archived":false,"fork":false,"pushed_at":"2022-03-23T17:27:12.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T09:03:58.033Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d8corp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-20T14:54:35.000Z","updated_at":"2022-02-22T12:06:46.000Z","dependencies_parsed_at":"2022-08-23T03:41:22.894Z","dependency_job_id":null,"html_url":"https://github.com/d8corp/innet-html","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/d8corp%2Finnet-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Finnet-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d8corp","download_url":"https://codeload.github.com/d8corp/innet-html/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744328,"owners_count":20988783,"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":[],"created_at":"2024-12-21T14:17:32.542Z","updated_at":"2025-04-07T23:15:44.131Z","avatar_url":"https://github.com/d8corp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.npmjs.com/package/innet\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/d8corp/innet/main/logo.svg\" align=\"left\" width=\"90\" height=\"90\" alt=\"InnetJs logo by Mikhail Lysikov\"\u003e\n\u003c/a\u003e\n\n# \u0026nbsp; @innet/html\n\n\u0026nbsp;\n\n[![NPM](https://img.shields.io/npm/v/@innet/html.svg)](https://github.com/d8corp/innet-html/blob/main/CHANGELOG.md)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/@innet/html)](https://bundlephobia.com/result?p=@innet/html)\n[![downloads](https://img.shields.io/npm/dm/@innet/html.svg)](https://www.npmjs.com/package/@innet/html)\n[![license](https://img.shields.io/npm/l/@innet/html)](https://github.com/d8corp/innet-html/blob/main/LICENSE)\n\n## Abstract\n\nThis package helps to convert jsx elements into html text.\n\n[![stars](https://img.shields.io/github/stars/d8corp/innet-html?style=social)](https://github.com/d8corp/innet-html/stargazers)\n[![watchers](https://img.shields.io/github/watchers/d8corp/innet-html?style=social)](https://github.com/d8corp/innet-html/watchers)\n\n## Install\nnpm\n```bash\nnpm i @innet/html\n```\nyarn\n```bash\nyarn add @innet/html\n```\n\nOr you can include the scripts into the `head`.\n```html\n\u003c!-- Target (innet) --\u003e\n\u003cscript defer src=\"https://unpkg.com/innet/innet.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- Target (innetHTML) --\u003e\n\u003cscript defer src=\"https://unpkg.com/@innet/html/innetHTML.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nYou can use `htmlPlugin` when you want to convert whole app.\n```typescript jsx\nimport innet, { createHandler } from 'innet'\nimport { htmlPlugin } from '@innet/html'\n\nconst handler = createHandler([\n  htmlPlugin,\n])\n\ninnet(\u003cdiv /\u003e, handler)\n// '\u003cdiv\u003e\u003c/div\u003e'\n```\n\nYou can combine it with other plugins to handle deep html.\n```typescript jsx\nimport innet, { createHandler } from 'innet'\nimport { array, arraySync } from '@innet/utils'\nimport { htmlPlugin } from '@innet/html'\n\nconst join = () =\u003e arr =\u003e arr.join('')\nconst handler = createHandler([\n  htmlPlugin,\n  array([\n    arraySync,\n    join,\n  ])\n])\n\ninnet((\n  \u003c\u003e\n    \u003ch1\u003eTest\u003c/h1\u003e\n    \u003cdiv class={'test'}\u003e\n      \u003cspan\u003e\n        \u003cimg src=\"#\" alt=\"test\" /\u003e\n      \u003c/span\u003e\n      \u003cp\u003e\n        Hello World!\n      \u003c/p\u003e\n    \u003c/div\u003e\n  \u003c/\u003e\n), handler)\n```\n\nAlso, you can use jsx plugin of `html` to handle it inside `html` component\n\n`handler.ts`\n```typescript jsx\nimport { createHandler } from 'innet'\nimport { array, arraySync, nullish, object, stop } from '@innet/utils'\nimport html from '@innet/html'\n\nconst join = () =\u003e arr =\u003e arr.join('')\n\nexport const handler = createHandler([\n  nullish([stop]),\n  array([arraySync, join]),\n  object([\n    jsxPlugins({\n      html,\n    }),\n  ]),\n])\n```\n\n`index.tsx`\n```typescript jsx\nimport innet from 'innet'\nimport { handler } from './handler'\n\ninnet(\u003chtml\u003e\u003cbase href='test' /\u003e\u003cbody /\u003e\u003c/html\u003e, handler)\n// \u003chtml\u003e\u003cbase href=\"test\"\u003e\u003cbody\u003e\u003c/body\u003e\u003c/html\u003e\n```\n\n## Issues\nIf you find a bug or have a suggestion, please file an issue on [GitHub](https://github.com/d8corp/innet-html/issues).\n\n[![issues](https://img.shields.io/github/issues-raw/d8corp/innet-html)](https://github.com/d8corp/innet-html/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Finnet-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd8corp%2Finnet-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Finnet-html/lists"}