{"id":16717401,"url":"https://github.com/panglesd/lighthigher","last_synced_at":"2025-04-10T06:43:06.764Z","repository":{"id":242099179,"uuid":"808680263","full_name":"panglesd/lighthigher","owner":"panglesd","description":"A highlighter that respects your html hierarchy","archived":false,"fork":false,"pushed_at":"2024-10-07T09:05:25.000Z","size":4587,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T07:49:12.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panglesd.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-05-31T15:24:12.000Z","updated_at":"2024-10-07T11:19:27.000Z","dependencies_parsed_at":"2024-05-31T17:21:54.444Z","dependency_job_id":"455e29ba-a29d-4e41-8ef3-3e036bd44eee","html_url":"https://github.com/panglesd/lighthigher","commit_stats":null,"previous_names":["panglesd/lighthigher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panglesd%2Flighthigher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panglesd%2Flighthigher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panglesd%2Flighthigher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panglesd%2Flighthigher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panglesd","download_url":"https://codeload.github.com/panglesd/lighthigher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248173433,"owners_count":21059594,"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":"2024-10-12T21:31:49.089Z","updated_at":"2025-04-10T06:43:06.745Z","avatar_url":"https://github.com/panglesd.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LightHigher\n\nA little helper that takes a \"highlighting function\", and an element, and use that function to syntax highlight the element, but **without losing the internal HTML structure**! (Element nodes are never removed from the DOM).\n\nThis allows you to add links, listen to events, ... in your `\u003ccode\u003e` elements while still being able to highlight them.\n\n## Demo\n\nSee [this demo](https://choum.net/panglesd/lighthigher.html)!\n\n## Usage:\n\n- Include the Javascript file currently at location `dist/lighthigher.js` (you can use a CDN: `\u003cscript src=\"https://cdn.jsdelivr.net/gh/panglesd/lighthigher@main/dist/lighthigher.min.js\"\u003e\u003c/script\u003e`)\n- Call `lighthight(highlight_function, elem)` where:\n  - `highlight_function` is a function taking a string and returning the string corresponding to the html of the highlighting. You can use any highlighter: `highlightjs`, `prismjs`, ...\n  - `elem` is the element you want to highlight\n\nHere is an example with `highlightjs`:\n\n```javascript\n// highlight all elements that have a class starting with \"language-\"\n// WITHOUT removing the HTML hierarchy\n// Assumes highlightjs is available as \"hljs\"\ndocument.querySelectorAll(\"[class^='language-']\").forEach((elem) =\u003e {\n  lighthigh((s) =\u003e { return hljs.highlightAuto(s).value }, elem );\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanglesd%2Flighthigher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanglesd%2Flighthigher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanglesd%2Flighthigher/lists"}