{"id":16125707,"url":"https://github.com/dy/xhtm","last_synced_at":"2025-09-12T21:33:10.145Z","repository":{"id":57401421,"uuid":"223442358","full_name":"dy/xhtm","owner":"dy","description":"XHTM − eXtended Hyperscript Tagged Markup","archived":false,"fork":false,"pushed_at":"2023-12-29T02:54:10.000Z","size":292,"stargazers_count":27,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-29T00:12:21.415Z","etag":null,"topics":["htm","html","jsx","preact","tagged-template","virtual-dom"],"latest_commit_sha":null,"homepage":"","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/dy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-22T16:24:15.000Z","updated_at":"2024-11-30T14:42:03.000Z","dependencies_parsed_at":"2023-12-27T22:24:43.381Z","dependency_job_id":"dc7e3178-6c33-44c5-b734-2f87103243ba","html_url":"https://github.com/dy/xhtm","commit_stats":{"total_commits":124,"total_committers":2,"mean_commits":62.0,"dds":0.008064516129032251,"last_synced_commit":"5d95b2ba501cbb7db593e38e2dcee9484f96633d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fxhtm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fxhtm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fxhtm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fxhtm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dy","download_url":"https://codeload.github.com/dy/xhtm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232792150,"owners_count":18577262,"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":["htm","html","jsx","preact","tagged-template","virtual-dom"],"created_at":"2024-10-09T21:30:50.504Z","updated_at":"2025-01-06T21:53:54.239Z","avatar_url":"https://github.com/dy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XHTM − eXtended HTM Tagged Markup\n\n\u003cp\u003e\n\u003ca href=\"https://github.com/dy/xhtm/actions/workflows/tests.js.yml\"\u003e\u003cimg src=\"https://github.com/dy/xhtm/actions/workflows/tests.js.yml/badge.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://bundlephobia.com/result?p=xhtm\"\u003e\u003cimg alt=\"size\" src=\"https://img.shields.io/bundlephobia/minzip/xhtm?label=size\"\u003e\u003c/a\u003e\n\u003ca href=\"https://npmjs.org/package/xhtm\"\u003e\u003cimg alt=\"version\" src=\"https://img.shields.io/npm/v/xhtm\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/stability-unstable-yellow\" alt=\"stability\"/\u003e\n\u003c/p\u003e\n\n_XHTM_ is alternative implementation of [HTM](https://ghub.io/htm) without HTM-specific limitations.\nLow-level machinery is rejected in favor of readability and better HTML support.\n\n## Differences from HTM\n\n* Self-closing tags support `` htm`\u003cinput\u003e\u003cbr\u003e` `` → `[h('input'), h('br')]`.\n* HTML directives `\u003c!doctype\u003e`, `\u003c?xml?\u003e` etc. support [#91](https://github.com/developit/htm/issues/91).\n* Optionally closed tags support `\u003cp\u003efoo\u003cp\u003ebar` → `\u003cp\u003efoo\u003c/p\u003e\u003cp\u003ebar\u003c/p\u003e` [#91](https://github.com/developit/htm/issues/91).\n* Interpolated props are exposed as arrays `` html`\u003ca class=\"a ${b} c\"/\u003e` `` → `h('a', { class: ['a ', b, ' c'] })`.\n* Calculated tag names [#109](https://github.com/developit/htm/issues/109) support.\n* Ignoring null-like arguments (customizable) [#129](https://github.com/developit/htm/issues/129).\n* Spaces formatting closer to HTML; elements with preserved formatting ([#23](https://github.com/dy/xhtm/issues/23)).\n* No integrations exported, no babel compilers.\n* No cache.\n\n\u003c!--\n* Dynamic attribute names [#124](https://github.com/developit/htm/issues/124).\n* Spaces are compatible with HTML (customizable) [#128](https://github.com/developit/htm/issues/128).\n* Escaping quotes [#96](https://github.com/developit/htm/issues/96).\n--\u003e\n\n## Installation \u0026 Usage\n\n\n[![NPM](https://nodei.co/npm/xhtm.png?mini=true)](https://nodei.co/npm/xhtm/)\n\n`xhtm` is by default fully compatible with `htm` and can be used as drop-in replacement.\n\n```js\nimport htm from 'xhtm'\nimport { render, h } from 'preact'\n\nhtml = htm.bind(h)\n\nrender(html`\n  \u003ch1\u003eHello World!\u003c/h1\u003e\n  \u003cp\u003eSome paragraph\u003cbr\u003e\n  \u003cp\u003eAnother paragraph\n`, document.getElementById('app'))\n```\n\nFor `htm` manual, refer to [htm docs](https://ghub.io/htm).\n\n## Justification\n\nGenerally HTM is a better choice, since it has better performance and enables caching.\u003cbr/\u003e\nBut if your app doesn't render components frequently or you need HTML support, then XHTM can be a good choice.  \nOriginally that was just minimal HTML parser implementation (~60LOC), best from 10 variants in R\u0026D branches.\u003cbr/\u003e\n\n\u003c!--\n## Comparison\n\n|                             | htm       | xhtm            | domtagger | hyperx   | common-tags |\n|---|:---:|:---:|:---:|:---:|:---:|\n| Size                        | 672b      | 512b            |  1186b    | 1949b    | 1242b       |\n| Performance: creation       | 88,111/s  | 30,000/s        |  7,604/s  | 58,961/s | 172,692/s   |\n| Performance: usage          | 617,870/s | 30,000/s        |  16,577/s | 60,888/s | 22,344/s    |\n| HTML Support                | -         | ~               |           |          |             |\n| JSX Support                 | +         | +               |           |          |             |\n| Output Format               | h         | h               |           |          |             |\n| Static Compiler             | +         | -               |           |          |             |\n--\u003e\n\n\u003cp align=\"center\"\u003e🕉️\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fxhtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdy%2Fxhtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fxhtm/lists"}