{"id":15377128,"url":"https://github.com/crashmax-dev/json-highlight-api","last_synced_at":"2025-04-06T08:28:47.226Z","repository":{"id":228966468,"uuid":"773813532","full_name":"crashmax-dev/json-highlight-api","owner":"crashmax-dev","description":"JSON syntax highlight","archived":false,"fork":false,"pushed_at":"2024-03-29T13:13:03.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T14:13:08.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crashmax-dev.github.io/json-highlight-api/","language":"TypeScript","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/crashmax-dev.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-03-18T12:54:54.000Z","updated_at":"2024-03-21T13:39:42.000Z","dependencies_parsed_at":"2024-12-19T17:11:22.587Z","dependency_job_id":"81ffc33f-75c2-4b77-9d41-dfbc30343cbd","html_url":"https://github.com/crashmax-dev/json-highlight-api","commit_stats":null,"previous_names":["crashmax-dev/json-highlight-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crashmax-dev%2Fjson-highlight-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crashmax-dev%2Fjson-highlight-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crashmax-dev%2Fjson-highlight-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crashmax-dev%2Fjson-highlight-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crashmax-dev","download_url":"https://codeload.github.com/crashmax-dev/json-highlight-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247455447,"owners_count":20941710,"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-01T14:09:46.515Z","updated_at":"2025-04-06T08:28:47.193Z","avatar_url":"https://github.com/crashmax-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-highlight-api\n\n\u003e [!WARNING]\n\u003e This package use [CSS Custom Highlight API](https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API)\n\n## Install\n\n```bash\npnpm add json-highlight-api\n```\n\n## Usage\n\n```ts\nimport { highlightJson, injectHighlight } from 'json-highlight-api'\n\nconst { style, destroy } = injectHighlight(/** override colors */)\ndocument.head.append(style)\n\n// remove the style element and css highlights from `CSS.highlights`\n// destroy()\n\nconst pre = document.createElement('pre')\npre.style.padding = '1rem'\npre.style.overflow = 'auto'\npre.style.color = '#d4d4d4'\npre.style.background = '#1e1e1e'\npre.style.whiteSpace = 'pre-wrap'\npre.textContent = JSON.stringify({ hello: 'world', age: 18 }, null, 2)\n\nconst code = document.createElement('code')\ncode.append(pre)\ndocument.body.append(code)\n\n// highlight pre tag\nhighlightJson(pre)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrashmax-dev%2Fjson-highlight-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrashmax-dev%2Fjson-highlight-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrashmax-dev%2Fjson-highlight-api/lists"}