vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.22k stars 2.13k forks source link

support protobuf highlight #4094

Closed cruvie closed 3 months ago

cruvie commented 3 months ago

Is your feature request related to a problem? Please describe.

The language 'protobuf' is not loaded, falling back to 'txt' for syntax highlighting.

Describe the solution you'd like

support protobuf highlight

Describe alternatives you've considered

I found shiki has already supported protobuf https://github.com/shikijs/shiki/pull/446

Additional context

No response

Validations

brc-dd commented 3 months ago

shiki doesn't support that - https://github.com/shikijs/textmate-grammars-themes/blob/57d88ad0bfccc6c50a5ea7bb9715f2a7d9b7f9d4/packages/tm-grammars/index.js#L2242-L2252

Create a PR there to fix it. That PR you mentioned was probably reverted, most likely accidentally by their bot (IIRC it didn't respect newly added aliases, similar things had happened with csharp aliases too).

You can manually alias that till your PR gets released:

// .vitepress/config.ts

import { defineConfig } from 'vitepress';

export default defineConfig({
  markdown: {
    languageAlias: {
      protobuf: 'proto',
    },
  },
});

https://stackblitz.com/edit/vite-b9klwm?file=docs/index.md,docs/.vitepress/config.ts