{"id":13907090,"url":"https://github.com/mburakerman/hrjs","last_synced_at":"2025-04-03T12:17:16.377Z","repository":{"id":20133022,"uuid":"88885097","full_name":"mburakerman/hrjs","owner":"mburakerman","description":"🔄 Tiny JavaScript plugin for highlighting and replacing text in the DOM","archived":false,"fork":false,"pushed_at":"2022-12-27T19:45:55.000Z","size":141,"stargazers_count":447,"open_issues_count":2,"forks_count":26,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-04-14T21:46:12.618Z","etag":null,"topics":["dom","highlight","highlight-text","javascript","replace-text"],"latest_commit_sha":null,"homepage":"https://mburakerman.github.io/hrjs/","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/mburakerman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-20T16:04:51.000Z","updated_at":"2023-12-18T22:55:13.000Z","dependencies_parsed_at":"2023-01-13T20:47:52.265Z","dependency_job_id":null,"html_url":"https://github.com/mburakerman/hrjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mburakerman%2Fhrjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mburakerman%2Fhrjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mburakerman%2Fhrjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mburakerman%2Fhrjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mburakerman","download_url":"https://codeload.github.com/mburakerman/hrjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246866378,"owners_count":20846561,"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":["dom","highlight","highlight-text","javascript","replace-text"],"created_at":"2024-08-06T23:01:47.593Z","updated_at":"2025-04-03T12:17:16.336Z","avatar_url":"https://github.com/mburakerman.png","language":"JavaScript","readme":"# HR.js\n\n\u003e Tiny JavaScript plugin for highlighting and replacing text in the DOM\n\n\u003cbr /\u003e\n\n[![NPM](https://img.shields.io/npm/v/hrjs)](https://www.npmjs.com/package/hrjs)\n![NPM License](https://img.shields.io/npm/l/hrjs)\n\n\u003cbr /\u003e\n\n## ⏬ Install\n\n```js\nnpm install hrjs\n```\n\nor use CDN:\n```html\n\u003cscript src=\"https://unpkg.com/hrjs\"\u003e\u003c/script\u003e\n```\n\n\n\n## 🪡 Usage\n\n```html\n\u003cp id=\"mytext\"\u003eLorem ipsum dolor sit amet.\u003c/p\u003e\n```\n\n```html\n\u003cscript\u003e\n  new HR(\"#mytext\", {\n    highlight: \"dolor\",\n    replaceWith: \"cat\",\n    backgroundColor: \"#B4FFEB\"\n  }).hr();\n\u003c/script\u003e\n```\nThat's it!\n\n[CodePen demo](https://codepen.io/anon/pen/ZKWBYV)\n\n![CodePen demo](https://media.giphy.com/media/l4FGuX1VuJFbENUjK/giphy.gif)\n\n\n\n### 🪡 Multiple Keywords example\n\nYou can also highlight and replace multiple keywords.\n\n```html\n\u003cp id=\"mytext\"\u003eI love JavaScript.\u003c/p\u003e\n```\n\n```html\n\u003cscript\u003e\n  new HR(\"#mytext\", {\n    highlight: [\"love\",\"JavaScript\"],\n    replaceWith: [\"like\", \"jQuery\"],\n    backgroundColor: \"#B4FFEB\"\n  }).hr();\n\u003c/script\u003e\n```\n[CodePen Multiple demo](https://codepen.io/anon/pen/XRdNbw)\n\n\n\n### 🪡 Highlight example\n\nTo highlight only, just add your keyword to `highlight` option.\n\n```html\n\u003cp class=\"mytext\"\u003eLorem ipsum dolor sit consectetur amet.\u003c/p\u003e\n\u003ch3 class=\"mytext\"\u003eConsectetur enim ipsam voluptatem quia\u003c/h3\u003e\n```\n\n```html\n\u003cscript\u003e\n  new HR(\".mytext\", {\n    highlight: \"consectetur\",\n    backgroundColor: \"#B4FFEB\"\n  }).hr();\n\u003c/script\u003e\n```\n[CodePen Highlight demo](https://codepen.io/anon/pen/Vbampm)\n\n\n## ✅ Test\nClone project, install dependencies and run `npm run test`\n\n\n## ⚙️ Customize\n\nThese are default options.\n\n```js\nnew HR(\"elem\", {\n  highlight: null,\n  replaceWith: null,\n  backgroundColor: \"#FFDE70\"\n}).hr();\n```\n\n\n## ©️ License\n\nLicensed under the MIT License.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmburakerman%2Fhrjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmburakerman%2Fhrjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmburakerman%2Fhrjs/lists"}