{"id":19952194,"url":"https://github.com/timluq/emmet-elem","last_synced_at":"2026-05-29T23:02:13.438Z","repository":{"id":94638477,"uuid":"469059540","full_name":"TimLuq/emmet-elem","owner":"TimLuq","description":"Lightweight emmet expansion to DOM","archived":false,"fork":false,"pushed_at":"2023-04-03T08:19:36.000Z","size":220,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T03:24:27.983Z","etag":null,"topics":["emmet"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimLuq.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":"2022-03-12T11:12:31.000Z","updated_at":"2022-03-15T00:44:41.000Z","dependencies_parsed_at":"2024-11-13T01:12:11.481Z","dependency_job_id":"fe8ac877-0ae2-4f43-adfb-b26bc89fe480","html_url":"https://github.com/TimLuq/emmet-elem","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/TimLuq/emmet-elem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimLuq%2Femmet-elem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimLuq%2Femmet-elem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimLuq%2Femmet-elem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimLuq%2Femmet-elem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimLuq","download_url":"https://codeload.github.com/TimLuq/emmet-elem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimLuq%2Femmet-elem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"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-11-26T02:00:06.075Z","response_time":193,"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":["emmet"],"created_at":"2024-11-13T01:12:06.747Z","updated_at":"2025-11-26T23:02:00.680Z","avatar_url":"https://github.com/TimLuq.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# emmet-elem\n\nA small standalone library (~2k gzipped) containing the logic behind parsing Emmet syntax and building a caching DOM tree.\n\nThe provided functions are `emmetSlots(strings, options = undefined)`, `slotted(template, ...nodeData)`, and `emmet(template, ...nodeData)`.\n\nFor the `slotted` and `emmet` functions to be compatible with template literal syntax, those are unable to contain options.\nAs the `options` object is used to specify the document and cache to use for creating `Node`s, there exists an extra function with global side-effects `setDefDoc(document)` that controls which document will be used by default.\n\n## `emmet` function\n\nThe `emmet` function will apply any parameters before returning an `Element` or `DocumentFragment` node expanded from the string.\n\nExample 1.1:\n```js\nconst root = emmet`(a#a\u003e(b.clss+c)*3)+d+e\u003e${4 * 2}`;\n\nassert(() =\u003e serializeToString(root) == [\n    `\u003ca id=\"a\"\u003e`,\n    `\u003cb class=\"clss\" /\u003e\u003cc /\u003e`,\n    `\u003cb class=\"clss\" /\u003e\u003cc /\u003e`,\n    `\u003cb class=\"clss\" /\u003e\u003cc /\u003e`,\n    `\u003c/a\u003e\u003cd /\u003e\u003ce\u003e8\u003c/e\u003e`\n].join(\"\"));\n```\n\nExample 1.2:\n```js\nconst root = emmet`(a#a\u003e(b.clss\u003e${\n    (paramId, idx, max) =\u003e paramId + \"\u003c\" + idx + \"/\" + max + \"\u003e\"\n}*2^c\u003e${\n    (paramId, idx, max) =\u003e paramId + \"\u003c\" + idx + \"/\" + max + \"\u003e\"\n})*3)+d+e\u003e${4 * 1}`;\n\nassert(() =\u003e serializeToString(root) == [\n    `\u003ca id=\"a\"\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;0/6\u0026gt;0\u0026lt;1/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;0/3\u0026gt;\u003c/c\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;2/6\u0026gt;0\u0026lt;3/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;1/3\u0026gt;\u003c/c\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;4/6\u0026gt;0\u0026lt;5/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;2/3\u0026gt;\u003c/c\u003e`,\n    `\u003c/a\u003e\u003cd /\u003e\u003ce\u003e4\u003c/e\u003e`\n].join(\"\"));\n```\n\n\n## `slotted` function\n\nThe `slotted` function will insert the special node `emmet-slot` at each parameter location and fill those with the given value before returning an `Element` or `DocumentFragment` node wrapped together with a list of slots.\n\nExample 2.1:\n```js\nconst { root, slots } = slotted`(a#a\u003e(b.clss+c)*3)+d+e\u003e${4 * 1}`;\nslots[0].textNode = \"8\";\n\nassert(() =\u003e serializeToString(root) == [\n    `\u003ca id=\"a\"\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;0/6\u0026gt;0\u0026lt;1/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;0/3\u0026gt;\u003c/c\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;2/6\u0026gt;0\u0026lt;3/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;1/3\u0026gt;\u003c/c\u003e`,\n    `\u003cb class=\"clss\"\u003e0\u0026lt;4/6\u0026gt;0\u0026lt;5/6\u0026gt;\u003c/b\u003e\u003cc\u003e1\u0026lt;2/3\u0026gt;\u003c/c\u003e`,\n    `\u003c/a\u003e\u003cd /\u003e\u003ce\u003e8\u003c/e\u003e`\n].join(\"\"));\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimluq%2Femmet-elem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimluq%2Femmet-elem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimluq%2Femmet-elem/lists"}