{"id":28436947,"url":"https://github.com/knadh/highlighted-input.js","last_synced_at":"2025-06-27T20:32:09.222Z","repository":{"id":280971071,"uuid":"943770546","full_name":"knadh/highlighted-input.js","owner":"knadh","description":"Super tiny, zero dep Javascript lib that highlights specific keywords and tags in an \u003cinput\u003e field.","archived":false,"fork":false,"pushed_at":"2025-04-26T15:45:08.000Z","size":12,"stargazers_count":27,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T23:08:04.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://knadh.github.io/highlighted-input.js","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/knadh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2025-03-06T08:37:31.000Z","updated_at":"2025-05-31T10:22:40.000Z","dependencies_parsed_at":"2025-03-06T10:28:34.259Z","dependency_job_id":null,"html_url":"https://github.com/knadh/highlighted-input.js","commit_stats":null,"previous_names":["knadh/highlighted-input.js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/knadh/highlighted-input.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fhighlighted-input.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fhighlighted-input.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fhighlighted-input.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fhighlighted-input.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knadh","download_url":"https://codeload.github.com/knadh/highlighted-input.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fhighlighted-input.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262327309,"owners_count":23294249,"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":"2025-06-05T23:08:03.832Z","updated_at":"2025-06-27T20:32:09.179Z","avatar_url":"https://github.com/knadh.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# highlighted-input.js\n\n\nhighlighted-input.js is a super tiny, zero dependency Javascript lib that highlights specific keywords and tags in an \u003ccode\u003e\u0026lt;input\u0026gt;\u003c/code\u003e field. It is ideal for search inputs to highlight field selectors as the user types. It is ~450 bytes minified+gzipped.\n\n[**View demo**](https://knadh.github.io/highlighted-input.js)\n\n[![demo](https://github.com/user-attachments/assets/d26afc80-4f4e-4782-b701-138c8ed76026)](https://knadh.github.io/highlighted-input.js)\n\n\n## Usage\n\n### Node\n```shell\nnpm install @knadh/highlighted-input\n```\n\n```javascript\nimport { highlightedInput } from @knadh/highlighted-input;\n\n// Initialize the highlighter with the input element and keyword map\nconst input = document.getElementById(\"input\");\n\n// .highlighted-h1 and .highlighted-h2 highlight classes.\nconst h1 = \"highlighted-h1\";\nconst h2 = \"highlighted-h2\";\n\n// Map of keywords to highlight and the corresponding classnames.\n// Copy styles from style.css and add it to the webpage. \nconst keywordMap = {\n    \"lang:\": h1, \n    \"repo:\": h1, \n    \"user:\": h1, \n    \"AND\": h2,\n    \"OR\": h2,\n    \"NOT\": h2,\n};\n\nhighlightedInput(input, keywordMap);\n```\n\nCopy the [CSS](https://github.com/knadh/highlighted-input.js/blob/master/style.css), customize it as required, and add it to the webpage.\n\n\nCheck the [demo source](https://github.com/knadh/highlighted-input.js/blob/master/docs/index.html) for a full example.\n\n### ES6 module\nCheck the [demo source](https://github.com/knadh/highlighted-input.js/blob/master/docs/index.html) to use the lib in `\u003cscript\u003e` directly in an HTML page.\n\nLicensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknadh%2Fhighlighted-input.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknadh%2Fhighlighted-input.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknadh%2Fhighlighted-input.js/lists"}