ZTL-UwU / shadcn-docs-nuxt

Effortless and beautiful docs template built with nuxt content & shadcn-vue.
https://shadcn-docs.nuxt.dev/
MIT License
67 stars 17 forks source link

Syntax highlighting not working for languages other than JavaScript and TypeScript #12

Closed deepakgohil9 closed 1 week ago

deepakgohil9 commented 1 week ago

Title: Syntax highlighting not working for languages other than JavaScript and TypeScript

Description:

I'm experiencing an issue with syntax highlighting. When I use code blocks with the following formatting:

```ts ... (TypeScript code here) ... ```

or

```js ... (JavaScript code here) ... ```

the syntax highlighting works perfectly. However, when I try to use code blocks for other languages, such as C++, the syntax highlighting is not applied.

Expected behavior:

Syntax highlighting should be applied for all supported languages within code blocks, regardless of the specific language used. This includes proper formatting for keywords, functions, variables, and other code elements.

Actual behavior:

Syntax highlighting only works for JavaScript and TypeScript code blocks. Code blocks for other languages, such as C++, appear as plain text without any highlighting.

Screenshot: image

Request:

Please investigate this issue and fix the syntax highlighting for languages other than JavaScript and TypeScript.

ZTL-UwU commented 1 week ago

You need to add the languages you want to content.highlight in your nuxt.config.ts.

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  extends: ['shadcn-docs-nuxt'],
  compatibilityDate: '2024-07-06',
  content: {
    highlight: {
      langs: ['c', 'cpp'],
    },
  },
});

See https://content.nuxt.com/get-started/configuration#highlight.

ZTL-UwU commented 1 week ago

If you're still having issues with it, feel free to reopen the issue.