{"id":15015990,"url":"https://github.com/nullvoxpopuli/highlightjs-glimmer","last_synced_at":"2025-10-29T02:42:02.056Z","repository":{"id":43454682,"uuid":"355014993","full_name":"NullVoxPopuli/highlightjs-glimmer","owner":"NullVoxPopuli","description":"glimmer syntax highlighting with highlight.js","archived":false,"fork":false,"pushed_at":"2024-04-29T00:06:15.000Z","size":2516,"stargazers_count":13,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T23:23:41.790Z","etag":null,"topics":["ember","emberjs","glimmer","glimmerjs","hacktoberfest","highlightjs"],"latest_commit_sha":null,"homepage":"https://hljs-glimmer.nullvoxpopuli.com/","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/NullVoxPopuli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2021-04-06T00:58:55.000Z","updated_at":"2024-05-05T23:25:57.417Z","dependencies_parsed_at":"2023-12-25T00:18:29.531Z","dependency_job_id":"92236a0a-a621-4bb1-87ac-c0281cd6fc3d","html_url":"https://github.com/NullVoxPopuli/highlightjs-glimmer","commit_stats":{"total_commits":355,"total_committers":6,"mean_commits":"59.166666666666664","dds":"0.48450704225352115","last_synced_commit":"ea39d5fcd7193fcb1be39199216dffd05d7d6f62"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Fhighlightjs-glimmer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Fhighlightjs-glimmer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Fhighlightjs-glimmer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NullVoxPopuli%2Fhighlightjs-glimmer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NullVoxPopuli","download_url":"https://codeload.github.com/NullVoxPopuli/highlightjs-glimmer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248549788,"owners_count":21122925,"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":["ember","emberjs","glimmer","glimmerjs","hacktoberfest","highlightjs"],"created_at":"2024-09-24T19:48:15.146Z","updated_at":"2025-10-29T02:42:01.974Z","avatar_url":"https://github.com/NullVoxPopuli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# highlightjs-glimmer\n\n[![npm version](https://badge.fury.io/js/highlightjs-glimmer.svg)](https://www.npmjs.com/package/highlightjs-glimmer)\n[![code quality](https://badgen.net/lgtm/grade/github/NullVoxPopuli/highlightjs-glimmer/js?label=code+quality)](https://lgtm.com/projects/g/NullVoxPopuli/highlightjs-glimmer/)\n\nglimmer syntax highlighting with [highlight.js](https://github.com/highlightjs/highlight.js)\n\n## Install\n\n```bash\nyarn add highlightjs-glimmer\n# or\nnpm install highlightjs-glimmer\n```\n\n\n## Compatibility\n\nRequires: [highlight.js \u003e= v11](https://github.com/highlightjs/highlight.js)\n\n|     | [Remark][1] | [Rehype][2] | [MarkdownIt][3] |\n| --  | ----------- | ----------- | --------------- |\n| cjs | ✅          | ✅          | ✅              |\n| esm | ❌[^1]      | ✅          | ✅              |\n\n[1]: https://github.com/remarkjs/remark-highlight.js\n[2]: https://github.com/rehypejs/rehype-highlight\n[3]: https://github.com/markdown-it/markdown-it\n[^1]: remark-highlight.js is deprecated and cjs only\n\n## Usage\n\n```js\nimport hljs from 'highlight.js';\nimport { setup } from 'highlightjs-glimmer';\n\nsetup(hljs);\n\nhljs.highlightAll();\n```\n\n - the `javascript` language must be registered before `setup` is called.\n - `setup` _must_ be called before any highlighting occurs.\n\nSupported language tags:\n\n```html\n\u003cpre\u003e\n  \u003ccode class=\"language-{tag}\"\u003e\n```\nwhere `{tag}` could be:\n - glimmer\n - hbs\n - html.hbs\n - html.handlebars\n - htmlbars\n\n**NOTE** because highlightjs-glimmer overrides the same aliases as highlightjs' handlebars grammar,\nto use the handlebars grammar align with the glimmer grammar, you'll need to use the full name in class\n```html\n\u003cpre\u003e\u003ccode class=\"lang-glimmer\"\u003e...\u003c/code\u003e\u003c/pre\u003e\n\u003cpre\u003e\u003ccode class=\"lang-handlebars\"\u003e...\u003c/code\u003e\u003c/pre\u003e\n```\n\n## with `await import(...)`\n\nWhen using ES Modules in browsers with a packager\n\n```ts\nlet HIGHLIGHT;\n\nasync function getHighlighter() {\n  if (HIGHLIGHT) return HIGHLIGHT;\n\n  HIGHLIGHT = (await import('highlight.js')).default;\n\n  let { setup } = await import('highlightjs-glimmer');\n\n  setup(HIGHLIGHT);\n\n  return HIGHLIGHT;\n}\n\n\nasync highlight() {\n  let hljs = await getHighlighter();\n\n  let element = document.querySelector('...');\n\n  hljs.highlightElement(element);\n}\n\nhighlight();\n```\n\n## API\n\n- `setup`\n\n    The convenience method for configuring everything related to\n    glimmer highlighting. This wraps `registerLanguage` and `registerInjections`.\n    For most use cases, this should be the only method you need.\n\n- `registerLanguage`\n\n    Convenience method for registering the glimmer template syntax with\n    highlight.js under the name \"glimmer\"\n\n- `registerInjections`\n\n    Registers the glimmer-javascript grammar, and installs `javascript`, `js`, `mjs` and `cjs`\n    as aliases of it\n\n- `glimmer`\n\n    The highlight.js grammar function for glimmer templates. This can be used to register\n    the glimmer grammar without using the provided setup methods.\n\n- `glimmerJavascript`\n\n    The highlight.js grammar function for glimmer-javascript (gjs) files. This can be used to register\n    the glimmer-javascript grammar without using the provided setup methods.\n\n## CDN Usage\n\n### Traditional Script Tags\n\n```html\n\u003cscript type=\"text/javascript\" src=\"/cdn/path/to/highlight.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"/cdn/path/to/highlightjs-glimmer/glimmer.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003ehljs.highlightAll();\u003c/script\u003e\n```\n\n### ES Modules\n\nAt this time, highlight.js does not ship ES Modules to CDNs\n\n```html\n\u003cscript type=\"text/javascript\" src=\"/cdn/path/to/highlight.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"module\"\u003e\n  import { glimmer } from '/cdn/path/to/highlightjs-glimmer/glimmer.esm.js';\n\n  hljs.registerLanguage('glimmer', glimmer);\n  hljs.highlightAll();\n\u003c/script\u003e\n```\n\n## Node / cjs / `require`\n\n```js\nconst hljs = require('highlight.js');\nconst { setup } = require('highlightjs-glimmer');\n\nsetup(hljs);\n\nhljs.highlightAll();\n```\n\nOnly Node 14 is supported\n\n## Node ES Modules / `import`\n\n```js\nimport hljs from 'highlight.js';\nimport { setup } from 'highlightjs-glimmer';\n\nsetup(hljs);\n\nhljs.highlightAll();\n```\n\nWith Node 14, launch with\n\n```bash\nNODE_OPTIONS=\"--experimental-vm-modules\" node your-module-script.js\n```\n\n## Contributing\n\nDebug with `yarn debug -p 4201`\nVisit `http://localhost:4201`\n\nRun Tets with `yarn test` or `npm run test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullvoxpopuli%2Fhighlightjs-glimmer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullvoxpopuli%2Fhighlightjs-glimmer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullvoxpopuli%2Fhighlightjs-glimmer/lists"}