Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 2.24 KB

CONTRIBUTING.md

File metadata and controls

58 lines (41 loc) · 2.24 KB

Contributing Guide

Thanks for lending a hand 👋

Development

Clone

This repository contains a git submodule to vscode-textmate. By default git clone does not clone submodules. To clone this repository and its submodules, use:

git clone --recursive https://github.com/shikijs/shiki

Or if you have already cloned it, use:

git submodule update --init --recursive

Learn more at this StackOverflow thread.

Setup

  • We use pnpm to manage dependencies. Install it with npm i -g pnpm.
  • Install dependencies with pnpm i.
  • Build all packages with pnpm build.

Packages Structure

graph TD
  tm-grammars([tm-grammars]) -.-> shiki
  core --> shiki
  tm-themes([tm-themes]) -.-> shiki
  shiki{{shiki}} --> twoslash
  shiki --> markdown-it
  shiki --> compat[/compat\]
  shiki --> rehype
  shiki --> monaco
  transformers
Loading
  • core contains the core logic of Shiki, without any languages/themes prebundled. Published as @shikijs/core.
  • shiki is the main package that bundles languages/themes from tm-grammars and tm-themes for easier usage. Published as shiki.
  • compat contains the compatibility layer for Shiki v0.x. Published as @shikijs/compat.
  • transformers contains common transformers for Shiki. Published as @shikijs/transformer.
  • The rest of the packages are high-level integrations on top of shiki.

Testing

  • We use Vitest to test the codebase. Run pnpm test to start the test runner.
  • We have quite some Snapshot Tests to ensure the output is consistent. If you are making changes to the output, run pnpm test -u to update the snapshots.

Coding conventions

  • We use ESLint to lint and format the codebase. Before you commit, all files will be formatted automatically.
  • We use Conventional Commits. Please use a prefix. If your PR has multiple commits and some of them don't follow the Conventional Commits rule, we'll do a squash merge.