{"id":24806155,"url":"https://github.com/xavierlacot/shiki-cli-binary","last_synced_at":"2026-04-30T07:37:39.057Z","repository":{"id":274794083,"uuid":"924046238","full_name":"xavierlacot/shiki-cli-binary","owner":"xavierlacot","description":"💅 Build the shiki syntax highlighter, with all the languages included, as a command line binary using Bun","archived":false,"fork":false,"pushed_at":"2025-01-30T13:49:12.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-10T14:29:00.230Z","etag":null,"topics":["bun","shiki","syntax-highlighting"],"latest_commit_sha":null,"homepage":"","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/xavierlacot.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,"zenodo":null}},"created_at":"2025-01-29T10:17:05.000Z","updated_at":"2025-01-30T13:48:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"af2c52f2-797c-4f6d-b7cb-9ae3e2a4647a","html_url":"https://github.com/xavierlacot/shiki-cli-binary","commit_stats":null,"previous_names":["xavierlacot/shiki-cli-binary"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xavierlacot/shiki-cli-binary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavierlacot%2Fshiki-cli-binary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavierlacot%2Fshiki-cli-binary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavierlacot%2Fshiki-cli-binary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavierlacot%2Fshiki-cli-binary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xavierlacot","download_url":"https://codeload.github.com/xavierlacot/shiki-cli-binary/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavierlacot%2Fshiki-cli-binary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32458237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bun","shiki","syntax-highlighting"],"created_at":"2025-01-30T08:19:21.229Z","updated_at":"2026-04-30T07:37:39.052Z","avatar_url":"https://github.com/xavierlacot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shiki-cli-binary\n\nThis repository allows to build the [shiki](https://shiki.style/) syntax highlighter, with all the languages and themes included, as a command line binary using [Bun](https://bun.sh).\n\n## Why?\n\nThe shiki syntax highlighter is a great tool to highlight code in a web page. However, it is written in TypeScript and requires a Node.js environment to run. This repository allows to build a binary that can be run on any platform without any dependency, making deployment easier.\n\n## Deploy\n\nYou can download the binary:\n\n```bash\nwget https://github.com/xavierlacot/shiki-cli-binary/releases/download/v0.0.1/shiki-cli\nchmod +x shiki-cli\n```\n\n## Usage\n\n### Highlight a code string\n\nThe following command outputs an highlighted code string to the standard output:\n\n```bash\n./shiki-cli /path/to/source-code.xyz --lang=language --theme=theme\n```\n\nThe `--lang` and `--theme` options are optional. If not provided, the default language is `text` and the default theme is `monokai`.\n\n### JSON mode\n\nThe `--json` option allows to process multiple code snippets at once, which can be useful to improve performance.\nWhen the `--json` option is provided, the input is expected to be a JSON array in the following format:\n\n```\n[\n  {\n    \"input\": \"source code\",\n    \"lang\": \"language\",\n    \"theme\": \"theme\",\n    ...\n  },\n  ...\n]\n```\n\nThe `lang` and `theme` fields are optional. If not provided, it defaults to the `--lang` and `--theme` cli options, or to `text` and `monokai` if not provided.\n\nEach object in the array is processed and the output is a JSON array with the same structure, with the `output` field containing the highlighted code. If the input array contained extra fields, they are preserved in the output. For example:\n\n```json\n// input.json\n[\n    {\n        \"lang\": \"typescript\",\n        \"input\": \"function greet(): void {\\n  console.log('Hello, world!');\\n}\\ngreet();\",\n        \"reference\": \"550e8400-e29b-41d4-a716-446655440004\"\n    },\n    {\n        \"lang\": \"php\",\n        \"input\": \"\u003c?php\\nfunction greet() {\\n  echo 'Hello, world!';\\n}\\ngreet();\\n?\u003e\",\n        \"reference\": \"550e8400-e29b-41d4-a716-446655440005\"\n    }\n]\n```\n\n```bash\n./shiki-cli input.json --json \u003e output.json\n```\n\n```json\n// output.json\n[\n  {\n    \"lang\": \"typescript\",\n    \"input\": \"function greet(): void {\\n  console.log('Hello, world!');\\n}\\ngreet();\",\n    \"reference\": \"550e8400-e29b-41d4-a716-446655440004\",\n    \"output\": \"\u003cpre class=\\\"shiki monokai\\\" style=\\\"background-color:#1f2937;color:#F8F8F2\\\" tabindex=\\\"0\\\"\u003e\u003ccode\u003e\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#66D9EF;font-style:italic\\\"\u003efunction\u003c/span\u003e\u003cspan style=\\\"color:#A6E22E\\\"\u003e greet\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e()\u003c/span\u003e\u003cspan style=\\\"color:#F92672\\\"\u003e:\u003c/span\u003e\u003cspan style=\\\"color:#66D9EF;font-style:italic\\\"\u003e void\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e {\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e  console.\u003c/span\u003e\u003cspan style=\\\"color:#A6E22E\\\"\u003elog\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e(\u003c/span\u003e\u003cspan style=\\\"color:#E6DB74\\\"\u003e'Hello, world!'\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e);\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e}\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#A6E22E\\\"\u003egreet\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e();\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\"\n  },\n  {\n    \"lang\": \"php\",\n    \"input\": \"\u003c?php\\nfunction greet() {\\n  echo 'Hello, world!';\\n}\\ngreet();\\n?\u003e\",\n    \"reference\": \"550e8400-e29b-41d4-a716-446655440005\",\n    \"output\": \"\u003cpre class=\\\"shiki monokai\\\" style=\\\"background-color:#1f2937;color:#F8F8F2\\\" tabindex=\\\"0\\\"\u003e\u003ccode\u003e\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#F92672\\\"\u003e\u0026#x3C;?\u003c/span\u003e\u003cspan style=\\\"color:#AE81FF\\\"\u003ephp\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#66D9EF;font-style:italic\\\"\u003efunction\u003c/span\u003e\u003cspan style=\\\"color:#A6E22E\\\"\u003e greet\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e() {\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#66D9EF\\\"\u003e  echo\u003c/span\u003e\u003cspan style=\\\"color:#E6DB74\\\"\u003e 'Hello, world!'\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e;\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e}\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#A6E22E\\\"\u003egreet\u003c/span\u003e\u003cspan style=\\\"color:#F8F8F2\\\"\u003e();\u003c/span\u003e\u003c/span\u003e\\n\u003cspan class=\\\"line\\\"\u003e\u003cspan style=\\\"color:#F92672\\\"\u003e?\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\"\n  }\n]\n```\n\n## Development\n\n### Install\n\nThis project requires the bun package manager ([see install instructions](https://bun.sh/docs/installation)).\n\n```bash\ngit clone https://github.com/xavierlacot/shiki-cli-binary.git\ncd shiki-cli-binary\nbun install\n```\n\n### Build\n\n```bash\nbun binary\n```\n\nThis generates a binary named `shiki-cli` in the current directory.\n\n### Lint\n\nSeveral commands are available to check, lint and format the code. The rely on [Biome](https://biomejs.dev/):\n\n```bash\nbun check\nbun format\nbun lint\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavierlacot%2Fshiki-cli-binary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxavierlacot%2Fshiki-cli-binary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavierlacot%2Fshiki-cli-binary/lists"}