{"id":15989171,"url":"https://github.com/robot-inventor/shell-session-syntax","last_synced_at":"2026-04-02T00:46:31.600Z","repository":{"id":227218795,"uuid":"770796362","full_name":"Robot-Inventor/shell-session-syntax","owner":"Robot-Inventor","description":"Grammar files for better syntax highlight of Shell Session","archived":false,"fork":false,"pushed_at":"2026-01-21T01:30:10.000Z","size":589,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-21T01:43:21.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Robot-Inventor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-12T07:13:46.000Z","updated_at":"2026-01-20T16:55:46.000Z","dependencies_parsed_at":"2024-03-25T03:22:59.332Z","dependency_job_id":"88f703ca-9f50-459e-9c65-b985f44fc978","html_url":"https://github.com/Robot-Inventor/shell-session-syntax","commit_stats":null,"previous_names":["robot-inventor/shell-session-syntax"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/Robot-Inventor/shell-session-syntax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robot-Inventor%2Fshell-session-syntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robot-Inventor%2Fshell-session-syntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robot-Inventor%2Fshell-session-syntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robot-Inventor%2Fshell-session-syntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Robot-Inventor","download_url":"https://codeload.github.com/Robot-Inventor/shell-session-syntax/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robot-Inventor%2Fshell-session-syntax/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28767013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T03:54:34.369Z","status":"ssl_error","status_checked_at":"2026-01-26T03:54:33.031Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-08T04:40:32.718Z","updated_at":"2026-01-26T05:02:17.269Z","avatar_url":"https://github.com/Robot-Inventor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shell-session-syntax\n\nGrammar files for better syntax highlight of Shell Session. This repository provides a TextMate grammar file in JSON format for ``shellsession`` syntax highlighting.\n\nI have merged the ``shellsession`` syntax used by GitHub and the powerful ``shellscript`` syntax used by VS Code.\n\n\u003e [!NOTE]\n\u003e You may also be interested in [regex-syntax](https://github.com/Robot-Inventor/regex-syntax) for syntax highlight of regular expressions.\n\n## Why?\n\nThis project was created to more properly syntax highlight ``shellsession`` in [Shiki.js](https://shiki.style/).\n\nThe grammar file used by Shiki does not highlight the first command in Shell Session, but it is difficult to change the existing behavior for [several reasons](https://github.com/shikijs/textmate-grammars-themes/issues/43).\n\nIf you load shell-session-syntax as a custom language grammar in Shiki, you will get better syntax highlighting of ``shellsession``.\n\n|              Shiki's default syntax               |                  shell-session-syntax                  |\n| :-----------------------------------------------: | :----------------------------------------------------: |\n| ![Shiki's default syntax](docs/shiki-default.png) | ![shell-session-syntax](docs/shell-session-syntax.png) |\n\nThis project automatically generates the grammar file. It uses [better-shell-syntax](https://github.com/jeff-hykin/better-shell-syntax/blob/master/autogenerated/shell.tmLanguage.json) for Shell grammar and [Linguist](https://github.com/github-linguist/linguist/) for Shell Session grammar. When merging these grammars, some patches are automatically applied.\n\n## Usage\n\nTo use shell-session-syntax in Shiki, please download ``./syntaxes/shell-session.tmLanguage.json`` or install the package and load it as a custom language grammar. It automatically overwrites the default ``shellsession`` grammar.\n\n```bash\nnpm install @robot-inventor/shell-session-syntax\n```\n\n```typescript\nimport { getHighlighter } from \"shiki\";\n// Directly import the downloaded file.\nimport shellSession from \"./shell-session.tmLanguage.json\";\n// Or import the package.\nimport shellSession from \"@robot-inventor/shell-session-syntax\";\n\nconst code = `\nuser@foo$ echo \"Hello, World!\" \u003e hello.txt\nHello, World!\nuser@foo$ ls -l | grep \".txt\"\nhello.txt\n`.trim();\n\nconst highlighter = await getHighlighter({\n    langs: [shellSession],\n    themes: [\"vitesse-dark\"]\n});\n\nconst html = highlighter.codeToHtml(code, {\n    lang: \"shellsession\",\n    theme: \"vitesse-dark\"\n});\n\nconsole.log(html);\n```\n\n## Update Grammar\n\nTo update the grammar file, run the following command. It automatically downloads the latest upstream grammar files and applies patches.\n\n```bash\nnpm run build\n```\n\n## Grammar Sources\n\nshell-session-syntax is generated by automatically applying patches to the following grammar files and merging them.\n\n- [better-shell-syntax](https://github.com/jeff-hykin/better-shell-syntax) ([MIT License](https://github.com/jeff-hykin/better-shell-syntax/blob/master/LICENSE))\n- [Linguist](https://github.com/github-linguist/linguist/) ([MIT License](https://github.com/github-linguist/linguist/blob/master/LICENSE))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobot-inventor%2Fshell-session-syntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobot-inventor%2Fshell-session-syntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobot-inventor%2Fshell-session-syntax/lists"}