/textmate-grammars-themes

Collection of TextMate grammars and themes in JSON

Primary LanguageJavaScriptMIT LicenseMIT

tm-grammars / tm-themes

tm-grammars tm-themes

Collection of TextMate grammars and themes, converted to JSON and re-distributed as npm packages. Extracted from Shiki, available for general usage.

Packages are automatically updated and published every day (if there are changes).

Preview Playground

Contribute

Add a new grammar

  1. Fork this repository.
  2. Install dependencies with pnpm install.
  3. Add grammar source and metadata to sources-grammars.ts.
  4. Add a code sample file <id>.sample for your language under ./samples. A sample should include a variety of language syntaxes and succinctly capture the idiosyncrasy of a language. Format requirements:
  • Space for indentation.
  • Less than 100 columns if possible.
  • A comment with a link to the source on the last line (e.g. # From https://poignant.guide/book/chapter-5.html).
  1. Generate a personal access token with the default permissions. This token is used to query public information from GitHub API and avoid rate limits.
  2. Create a .env file and paste your generated token into the file like so:
GITHUB_TOKEN=your-personal-access-token
  1. Run pnpm run fetch to download the grammar.
  2. Run pnpm run play to start the playground. Select the new grammar in the left column to verify the accuracy and confirm that the grammar works as expected.
  3. Send in the PR!

Add a new theme

  1. Fork this repository.
  2. Install dependencies with pnpm install.
  3. Add theme source and metadata to sources-themes.ts.
  4. Generate a personal access token with the default permissions. This token is used to query public information from GitHub API and avoid rate limits.
  5. Create a .env file and paste your generated token into the file like so:
GITHUB_TOKEN=your-personal-access-token
  1. Run pnpm run fetch to download the theme.
  2. Run pnpm run play to start the playground. Select the new theme in the right column to verify the accuracy and confirm that the theme works as expected.
  3. Send in the PR!

License

The grammars and themes included in this package are covered by their repositories’ respective licenses, which are permissive (apache-2.0, mit, etc), and made available in Grammars NOTICE and Themes NOTICE.

All other files MIT © Pine Wu & Anthony Fu.