Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docusaurus] entrypoint to add custom textmate grammar ? #190

Open
Baccata opened this issue Sep 27, 2023 · 1 comment
Open

[Docusaurus] entrypoint to add custom textmate grammar ? #190

Baccata opened this issue Sep 27, 2023 · 1 comment

Comments

@Baccata
Copy link

Baccata commented Sep 27, 2023

Hello everyone.

I'm looking for a way to configure the docusaurus plugin with a custom textmate grammar to get highlighting for languages that aren't supported out-of-the-box by Shiki.

Could anyone offer some guidance as to what would be the most straightforward way to achieve this ?

@lachieh
Copy link

lachieh commented Nov 15, 2023

You should be able to add the custom grammar in the options at the same place you define which themes to use. Note that you have to extend the existing languages by importing them from the 'shiki' package. As an example, this is how I've handled it:

import { BUNDLED_LANGUAGES } from 'shiki';

// see docs for where to put options:
{
  themes: ['github-light', 'github-dark'],
  langs: [
    ...BUNDLED_LANGUAGES,
    {
      id: 'wit',
      scopeName: 'source.wit',
      path: path.resolve('./languages/wit.tmLanguage.json'),
      aliases: ['wit'],
    },
  ],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants