{"id":28384488,"url":"https://github.com/roydukkey/custom-highlight","last_synced_at":"2026-01-20T05:04:33.150Z","repository":{"id":291111676,"uuid":"975898059","full_name":"roydukkey/custom-highlight","owner":"roydukkey","description":"Lifecycle hooks for styling arbitrary text within an HTML Element","archived":false,"fork":false,"pushed_at":"2025-12-13T01:46:18.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T12:49:50.935Z","etag":null,"topics":["css","lifecycle-hooks","vue-directive"],"latest_commit_sha":null,"homepage":"https://custom-highlight.pages.dev/","language":"TypeScript","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/roydukkey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yaml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["roydukkey"]}},"created_at":"2025-05-01T05:31:08.000Z","updated_at":"2025-12-13T01:46:21.000Z","dependencies_parsed_at":"2025-12-13T02:03:18.688Z","dependency_job_id":null,"html_url":"https://github.com/roydukkey/custom-highlight","commit_stats":null,"previous_names":["roydukkey/custom-highlight"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/roydukkey/custom-highlight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fcustom-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fcustom-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fcustom-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fcustom-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roydukkey","download_url":"https://codeload.github.com/roydukkey/custom-highlight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roydukkey%2Fcustom-highlight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28596087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["css","lifecycle-hooks","vue-directive"],"created_at":"2025-05-30T08:38:50.381Z","updated_at":"2026-01-20T05:04:33.137Z","avatar_url":"https://github.com/roydukkey.png","language":"TypeScript","funding_links":["https://github.com/sponsors/roydukkey"],"categories":[],"sub_categories":[],"readme":"# `custom-highlight`\n\nA set of lifecycle hooks for styling arbitrary text within elements using the [CSS Custom Highlight API](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API).\n\n[![Release Version](https://img.shields.io/npm/v/custom-highlight.svg)](https://www.npmjs.com/package/custom-highlight)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n* Highlight **single or multiple tokens** within an element, or patterns using a **regular expression**\n* Easily configure **case-insensitive** searching for tokens and patterns\n* Define **custom highlight groups** for targeting each with unique styles\n* Deeply monitor changes to character data triggering an update to highlights\n\n## Install\n\n```sh\nnpm install custom-highlight\n```\n\n## CDN\n\n```html\n\u003cscript src=\"https://unpkg.com/custom-highlight\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/custom-highlight\"\u003e\u003c/script\u003e\n```\n\nIt will be exposed globally as `window.CustomHighlight`.\n\n\n## Usage\n\nHere is a very basic example that will highlight the words “brown fox” in the paragraph.\n\n```html\n\u003cp id=\"gettingStarted\"\u003eThe quick brown fox jumps over the lazy dog.\u003c/p\u003e\n\n\u003cscript type=\"module\"\u003e\nimport CustomHighlight from 'custom-highlight';\n\nconst element = document.getElementById('gettingStarted');\nconst options = { value: 'brown fox' };\n\nif (element) {\n  CustomHighlight\n    .created(element, options)\n    .beforeMount(element, options)\n    .mounted(element, options);\n}\n\u003c/script\u003e\n\n\u003cstyle\u003e\n  ::highlight(default) {\n    background-color: yellow;\n    color: black;\n  }\n\u003c/style\u003e\n```\n\nThis works just fine in a static webpage, but frameworks that dynamically render content by manipulating the DOM (e.g. Vue, React, Svelte, etc.) will require additional effort in conforming to their component lifecycles.\n\nSee the [docs](https://custom-highlight.pages.dev/) for examples and recipes using [Vue](https://custom-highlight.pages.dev/recipes/vue.html) and native [Web Components](https://custom-highlight.pages.dev/recipes/web-component.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fcustom-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froydukkey%2Fcustom-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froydukkey%2Fcustom-highlight/lists"}