{"id":13446741,"url":"https://github.com/atom/highlights","last_synced_at":"2025-03-21T16:32:48.416Z","repository":{"id":15155640,"uuid":"17883188","full_name":"atom/highlights","owner":"atom","description":"Syntax highlighter","archived":true,"fork":false,"pushed_at":"2022-09-28T10:52:01.000Z","size":537,"stargazers_count":531,"open_issues_count":26,"forks_count":66,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-04-08T16:24:42.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://atom.github.io/highlights","language":"CoffeeScript","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/atom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-18T21:46:28.000Z","updated_at":"2024-01-12T14:47:33.000Z","dependencies_parsed_at":"2022-09-10T14:51:49.111Z","dependency_job_id":null,"html_url":"https://github.com/atom/highlights","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fhighlights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fhighlights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fhighlights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fhighlights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atom","download_url":"https://codeload.github.com/atom/highlights/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244829612,"owners_count":20517342,"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-07-31T05:00:58.588Z","updated_at":"2025-03-21T16:32:47.909Z","avatar_url":"https://github.com/atom.png","language":"CoffeeScript","readme":"##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)\n ![](https://f.cloud.github.com/assets/671378/2454103/24d89962-aee6-11e3-9dcf-ee2d81ec0373.jpg)\n\nReads in code, writes out HTML with CSS classes based on the tokens in the code.\n\n[![CI](https://github.com/atom/highlights/actions/workflows/ci.yml/badge.svg)](https://github.com/atom/highlights/actions/workflows/ci.yml)\n\nSee it in action [here](https://atom.github.io/highlights/examples).\n\n### Installing\n\n```sh\nnpm install highlights\n```\n\n### Using\n\nRun `highlights -h` for full details about the supported options.\n\nTo convert a source file to tokenized HTML run the following:\n\n```sh\nhighlights file.coffee -o file.html\n```\n\nNow you have a `file.html` file that has a big `\u003cpre\u003e` tag with a `\u003cdiv\u003e` for\neach line with `\u003cspan\u003e` elements for each token.\n\nThen you can compile an existing Atom theme into a stylesheet with the\nfollowing:\n\n```sh\ngit clone https://github.com/atom/atom-dark-syntax\ncd atom-dark-syntax\nnpm install -g less\nlessc --include-path=styles index.less atom-dark-syntax.css\n```\n\nNow you have an `atom-dark-syntax.css` stylesheet that be combined with\nthe `file.html` file to generate some nice looking code.\n\nCheck out the [examples](https://atom.github.io/highlights/examples) to see\nit in action.\n\nCheck out [atom.io](https://atom.io/packages) to find more themes.\n\nSome popular themes:\n  * [atom-dark-syntax](https://github.com/atom/atom-dark-syntax)\n  * [atom-light-syntax](https://github.com/atom/atom-light-syntax)\n  * [solarized-dark-syntax](https://github.com/atom/solarized-dark-syntax)\n  * [solarized-light-syntax](https://github.com/atom/solarized-light-syntax)\n\n#### Using in code\n\n```coffee\nHighlights = require 'highlights'\nhighlighter = new Highlights()\nhtml = highlighter.highlightSync\n  fileContents: 'var hello = \"world\";'\n  scopeName: 'source.js'\n\nconsole.log html\n```\n\nOutputs:\n\n```html\n\u003cpre class=\"editor editor-colors\"\u003e\n  \u003cdiv class=\"line\"\u003e\n    \u003cspan class=\"source js\"\u003e\n      \u003cspan class=\"storage modifier js\"\u003e\u003cspan\u003evar\u003c/span\u003e\u003c/span\u003e\n      \u003cspan\u003e\u0026nbsp;hello\u0026nbsp;\u003c/span\u003e\n      \u003cspan class=\"keyword operator js\"\u003e\u003cspan\u003e=\u003c/span\u003e\u003c/span\u003e\n      \u003cspan\u003e\u0026nbsp;\u003c/span\u003e\n      \u003cspan class=\"string quoted double js\"\u003e\n        \u003cspan class=\"punctuation definition string begin js\"\u003e\u003cspan\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e\n        \u003cspan\u003eworld\u003c/span\u003e\n        \u003cspan class=\"punctuation definition string end js\"\u003e\u003cspan\u003e\u0026quot;\u003c/span\u003e\u003c/span\u003e\n      \u003c/span\u003e\n      \u003cspan class=\"punctuation terminator statement js\"\u003e\u003cspan\u003e;\u003c/span\u003e\u003c/span\u003e\n    \u003c/span\u003e\n  \u003c/div\u003e\n\u003c/pre\u003e\n```\n\n### Loading Grammars From Modules\n\nhighlights exposes the method `requireGrammarsSync`, for loading grammars from\nnpm modules. The usage is as follows:\n\n```bash\nnpm install atom-language-clojure\n```\n\n```coffee\nHighlights = require 'highlights'\nhighlighter = new Highlights()\nhighlighter.requireGrammarsSync\n  modulePath: require.resolve('atom-language-clojure/package.json')\n```\n\n### Developing\n\n* Clone this repository `git clone https://github.com/atom/highlights`\n* Update the submodules by running `git submodule update --init --recursive`\n* Run `npm install` to install the dependencies, compile the CoffeeScript, and\n  build the grammars\n* Run `npm test` to run the specs\n\n:green_heart: Pull requests are greatly appreciated and welcomed.\n","funding_links":[],"categories":["CoffeeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fhighlights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatom%2Fhighlights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fhighlights/lists"}