{"id":13996031,"url":"https://github.com/inkle/ink-tmlanguage","last_synced_at":"2025-05-15T21:34:21.881Z","repository":{"id":32803533,"uuid":"143127849","full_name":"inkle/ink-tmlanguage","owner":"inkle","description":"TextMate grammar files for Ink. (VS Code, Sublime Text, and Atom)","archived":false,"fork":false,"pushed_at":"2022-01-07T23:19:38.000Z","size":368,"stargazers_count":17,"open_issues_count":2,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-24T12:24:47.847Z","etag":null,"topics":["grammar","ink","inkle","syntax-highlighting","textmate-grammar","textmate-language","tmlanguage"],"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/inkle.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}},"created_at":"2018-08-01T08:36:11.000Z","updated_at":"2023-07-29T21:43:28.000Z","dependencies_parsed_at":"2022-08-07T18:01:51.812Z","dependency_job_id":null,"html_url":"https://github.com/inkle/ink-tmlanguage","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkle%2Fink-tmlanguage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkle%2Fink-tmlanguage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkle%2Fink-tmlanguage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkle%2Fink-tmlanguage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inkle","download_url":"https://codeload.github.com/inkle/ink-tmlanguage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225382129,"owners_count":17465654,"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":["grammar","ink","inkle","syntax-highlighting","textmate-grammar","textmate-language","tmlanguage"],"created_at":"2024-08-09T14:03:45.144Z","updated_at":"2024-11-19T15:47:56.211Z","avatar_url":"https://github.com/inkle.png","language":"TypeScript","readme":"# ![Ink TMLanguage](https://i.imgur.com/oLMOVfq.png)\n\n[![Build Status](https://github.com/inkle/ink-tmlanguage/workflows/build/badge.svg)](https://github.com/inkle/ink-tmlanguage/actions)\n[![npm version](https://img.shields.io/npm/v/ink-tmlanguage.svg)](https://www.npmjs.com/package/ink-tmlanguage)\n[![Licence](https://img.shields.io/npm/l/ink-tmlanguage.svg)](https://github.com/inkle/ink-tmlanguage/blob/master/LICENSE)\n[![Dependencies](https://david-dm.org/ephread/ink-tmlanguage/status.svg)](https://david-dm.org/inkle/ink-tmlanguage)\n\nBrings syntax highlighting for inkle's Ink, in your editor of choice (as long as\nit supports TextMate grammars).\n\nIf you're just looking for the plist-based grammar, head over to the [releases](https://github.com/inkle/ink-tmlanguage/releases)!\n\n## Table of contents\n\n  * [Building the grammar](#building-the-grammar)\n  * [Limitations](#limitations)\n  * [Building a custom theme](#building-a-custom-theme)\n  * [Availability through NPM](#availability-through-npm)\n  * [Contributing](#contributing)\n  * [License](#license)\n\n## Building the grammar\n\nThe grammar is written using the `YAML-tmLanguage` format, with a couple of\nadditions borrowed from [TypeScript-TmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage).\n\nBuilding the grammar is easy, you need the latest version of node.js and your favourite npm-compatible package manager.\n\n1. clone this repository;\n2. run `npm install` or `yarn install`;\n3. run `npm run build` or `yarn run build`;\n4. the `Ink.tmLanguage` file should be available in `grammars/`.\n\n## Limitations\n\n### `{ }` constructs\n\nIn Ink, `{ }` can be an alternative, a sequence, a switch, a conditional, etc.\nSince TextMate grammars can only match one line at a time, there are some small limitations.\n\n#### Expressions\n\nExpressions will not be fully highlighted in conditionals.\nAnything contained in the condition (before `:`) is named with the same scope.\n\n```ink\n{ x == 0: Hello }\n{ x == 0: Hello | hi }\n{ x == 0:\n\tHello\n  - else:\n  \tHi\n}\n{\n\t- x == 0:\n\t\tHello\n}\n{ window_opts \u003c 2 || learnt(fingerprints_on_glass) || GlassState ? steamed:\n\tI looked away from the dreary glass.\n}\n```\n\nThis is not the case in the following example, where all expression tokens are named with their own scopes.\n\n```ink\n~ y = (x == 0)\n~ myFunction(x == 0)\n```\n\nAdditionally, while the following is perfectly valid ink, there's a false positive on both `else:` and `then:`.\n\n```ink\n{conditional()}\n{conditional()}\n{conditional()}\n{conditional()}\n\n=== function conditional() ===\n{once:\n  - if condition\n  - then: do this\n  - else: do that\n  - end\n}\n```\n\nThis limitation can be worked around by escaping the colon:\n\n```ink\n=== function conditional() ===\n{once:\n  - if condition\n  - then\\: do this\n  - else\\: do that\n  - end\n}\n```\n\n### Choices\n\nIn choice, it's sometimes possible for the content to be expressed on the next line\nif it's preceded by a condition. In the example below, the text supression of\nthe first choice will not be highlighted, as it won't be matched as part of the choice.\nThe second choice will however be highlighted properly.\n\n```ink\nVAR x = 0\n\n* (firstChoice) {x == 0}\n\"Hello John Doe[.\"], I need to tell you something special\"\n\n* (secondChoice) {x != 0} \"Hello John Doe[.\"], I won't say a word\"\n```\n\n## Building a custom theme\n\nAll the captures support the generic scopes recommended by the [Sublime Text documentation](https://www.sublimetext.com/docs/3/scope_naming.html), narrowed down to `.ink`. This means that the grammar will work out of box with existing themes.\n\nMost of the captures are multi-scoped, with the first scope defined by the theme being used. Some of these multi-scoped captures support ink-specific scopes, which can be implemented by your custom theme. They are described below:\n\n- `string.label.ink` → `(label)`\n- `entity.tag.ink` → `#tag`\n- `entity.todo.ink` → `TODO`\n- `keyword.glue.ink` → `\u003c\u003e`\n- `keyword.choice.ink` → `*`\n- `keyword.choice.sticky.ink` → `+`\n- `keyword.choice.suppression.ink` → `[ ]`\n- `keyword.logic.ink` → `~`\n- `keyword.gather.ink` → `-`\n- `keyword.divert.ink` → `-\u003e` or `\u003c-`\n- `keyword.alternative.type.ink` → `\u0026` or `~` or `!` inside `{ }`\n- `storage.knot.ink` → Identifier after / between `=`\n- `variable.other.knot.ink` → a knot identifier in a divert\n- `variable.other.stitch.ink` → a stitch identifier in a divert\n- `variable.other.label.ink` → a label identifier in a divert\n\n## Availability through npm\n\nAs a convenience, the grammar is also available through the npm registry.\nIf you're building an extension for Atom or VS Code, you may want to depend on this package.\n\nOnce installed, the grammar can be found in `node_modules/ink-tmlanguage/grammars/Ink.tmLanguage`.\n\n## Contributing\n\nIf the grammar is missing something, open an issue or fix it and submit a pull request!\nWhen working on the grammar, you may want to use `npm run watch`, which will rebuild the plist grammar on every change.\n\n## License\n\nThe grammar is released under the MIT license. See LICENSE for details.\n\nThis project borrows some code from [TypeScript-TmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage), licensed under the [MIT license](https://github.com/Microsoft/TypeScript-TmLanguage/blob/4a620294f8652e4e3a4a605308650a52773ccec6/LICENSE.txt).\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkle%2Fink-tmlanguage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finkle%2Fink-tmlanguage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkle%2Fink-tmlanguage/lists"}