{"id":15383627,"url":"https://github.com/knownasilya/jquery-highlight","last_synced_at":"2025-04-06T09:09:07.503Z","repository":{"id":9713457,"uuid":"11667617","full_name":"knownasilya/jquery-highlight","owner":"knownasilya","description":"A Bower wrapper for @bartaz modification to the jQuery Term Highlighting plugin.","archived":false,"fork":false,"pushed_at":"2023-04-15T13:40:20.000Z","size":329,"stargazers_count":45,"open_issues_count":7,"forks_count":27,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T08:07:58.678Z","etag":null,"topics":["highlight","jquery","jquery-plugin"],"latest_commit_sha":null,"homepage":"http://bartaz.github.io/sandbox.js/jquery.highlight.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"elodina/elodina.github.io","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knownasilya.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2013-07-25T18:15:09.000Z","updated_at":"2023-03-28T14:27:28.000Z","dependencies_parsed_at":"2024-06-18T14:06:56.507Z","dependency_job_id":"cd24d6a1-dd3d-4ce0-8a78-d37d0414d9c2","html_url":"https://github.com/knownasilya/jquery-highlight","commit_stats":{"total_commits":52,"total_committers":11,"mean_commits":"4.7272727272727275","dds":0.6730769230769231,"last_synced_commit":"72cbf9c740a350b5d31c7a8cbb63b94077e85b1f"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knownasilya%2Fjquery-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knownasilya%2Fjquery-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knownasilya%2Fjquery-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knownasilya%2Fjquery-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knownasilya","download_url":"https://codeload.github.com/knownasilya/jquery-highlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457802,"owners_count":20941906,"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":["highlight","jquery","jquery-plugin"],"created_at":"2024-10-01T14:39:03.054Z","updated_at":"2025-04-06T09:09:07.485Z","avatar_url":"https://github.com/knownasilya.png","language":"JavaScript","readme":"jQuery.Highlight.js\n===================\n\nText highlighting plugin for jQuery.\n\nOriginal [code][1] and [documentation][2].\n\n- [Install](#install)\n- [API](#api)\n- [Examples](#examples)\n- [Attribution](#attribution)\n\n## Install\n\nHow to use this plugin.\n\n_Note: This plugin requires jQuery to be included, which is left up to you._\n\nFirst you need to install the module, which can be installed in one\nof the following ways:\n\n```bash\nnpm install jquery-highlight\nbower install jquery-highlight\ncomponent install knownasilya/jquery-highlight\n# or just download it from Github\n```\n\n## API\n\n### `$.highlight`\n\nFunction signature: `highlight(word, options, callback)`\n\nThe parameters are:\n\n  **word** `string|array` (required)\n  \n  string such as `\"lorem\"` or `\"lorem ipsum\"` or an array of string such as `[\"lorem\", \"ipsum\"]` \n  \n  **options** `object` (optional)\n  \n  object with the following available options\n\n   * `className` -- The CSS class of a highlighted element, defaults to 'highlight'.\n   * `element` -- The element that wraps the highlighted word, defaults to 'span'.\n   * `caseSensitive` -- If the search should be case sensitive, defaults to `false`.\n   * `wordsOnly` -- If we want to highlight partial sections of a word, e.g. 'ca' from 'cat', defaults to `false`.\n   * `wordsBoundary` -- If `wordsOnly` is set to `true`, this is used to determine these boundaries, defaults to `\\\\b` (word boundary).\n   * `wordsBoundaryStart` -- If `wordsOnly` is set to `true`, this is used to determine prefix word boundaries, defaults to the value of `wordsBoundary`.\n   * `wordsBoundaryEnd` -- If `wordsOnly` is set to `true`, this is used to determine suffix word boundaries, defaults to the value of `wordsBoundary`.\n    \n**callback** `function` (optional)\n\nfunction that will be called for each DOM node/element highlighted\n  \n\n### `$.unhighlight`\n\nFunction signature: `unhighlight(options)`:\n\nThe parameters are:\n\n**options** `object` (optional)\n\n  object with the following available options\n\n  * `className`  -- The highlights to remove based on CSS class, defaults to 'highlight'.\n  * `element` -- The highlights to remove based on HTML element, defaults to 'span'.\n\n## Examples\n\nBelow are several ways that you can utilize this plugin.\n\n```js\n// wrap every occurrence of text 'lorem' in content\n// with \u003cspan class='highlight'\u003e (default options)\n$('#content').highlight('lorem');\n\n// search for and highlight more terms at once\n// so you can save some time on traversing DOM\n$('#content').highlight(['lorem', 'ipsum']);\n$('#content').highlight('lorem ipsum');\n\n// wrap every occurrence of text 'lorem' in content\n// with \u003cspan class='highlight'\u003e (default options)\n// log every word highlighted to the console using the invoked callback\n$('#content').highlight('lorem', {}, function(el) {\n console.log('highligting DOM element', el)\n});\n\n// search only for entire word 'lorem'\n$('#content').highlight('lorem', {\n  wordsOnly: true\n});\n\n// search only for the entire word 'C#'\n// and make sure that the word boundary can also\n// be a 'non-word' character, as well as a regex latin1 only boundary:\n$('#content').highlight('C#', {\n  wordsOnly: true,\n  wordsBoundary: '[\\\\b\\\\W]'\n});\n\n// search only for the entire word 'C++'\n// and make sure that the word boundary can also\n// be a 'non-word' character, as well as a regex latin1 only boundary:\n$('#content').highlight('C++', {\n  wordsOnly: true,\n  wordsBoundaryEnd: '\\\\W*\\\\b'\n});\n\n\n// don't ignore case during search of term 'lorem'\n$('#content').highlight('lorem', {\n  caseSensitive: true\n});\n\n// wrap every occurrance of term 'ipsum' in content\n// with \u003cem class='important'\u003e\n$('#content').highlight('ipsum', {\n  element: 'em',\n  className: 'important'\n});\n\n// remove default highlight\n$('#content').unhighlight();\n\n// remove custom highlight\n$('#content').unhighlight({\n  element: 'em',\n  className: 'important'\n});\n```\n\n\n## Attribution\n\nPlugin was originally created by Bartek Szopka ([@bartaz][bartaz]).\n\n## License\n\nMIT\n\n[1]: https://github.com/bartaz/sandbox.js/blob/master/jquery.highlight.js\n[2]: http://bartaz.github.io/sandbox.js/jquery.highlight.html\n[bartaz]: https://github.com/bartaz\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknownasilya%2Fjquery-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknownasilya%2Fjquery-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknownasilya%2Fjquery-highlight/lists"}