Each language config supports both string and [string, string] formats. In the array format, the former is the alias of the language, and the latter is the full name of the language. You can go to the file list to view all supported language full names.
Here can be understood as we can configure aliases to map some unsupported languages to the languages supported by prism( etc ['mdx', 'tsx']), or we can also make an abbreviation for a certain language ( etc ['oc', 'objectivec'])
But now there should be some problems in existing implementation, below code block are not highlighted.
`['mdx', 'tsx']` is the `DEFAULT_HIGHLIGHT_LANGUAGES` in https://github.com/web-infra-dev/rspress/blob/e42143357e9071bbc2e1e1821d29d4e66f1efd45/packages/shared/src/runtime-utils/index.ts#L11-L26
You can also try `['mdx', 'md']`, may be also check whether there are any problems with the logic of merging and deduplication highlight languages.
3. add some code blocks like below in `index.mdx`
![image](https://github.com/web-infra-dev/rspress/assets/50201324/8f56d387-115a-40b6-ae46-4b88da7dfcbf)
(since github will transform the raw code, so screenshot here)
4. run `pnpm dev`
6. see if the code is highlighted
Version
Details
In Rspress doc https://rspress.dev/api/config/config-build#markdownhighlightlanguages
Here can be understood as we can configure aliases to map some unsupported languages to the languages supported by prism( etc
['mdx', 'tsx']
), or we can also make an abbreviation for a certain language ( etc['oc', 'objectivec']
)But now there should be some problems in existing implementation, below code block are not highlighted.
Reproduce link
https://github.com/web-infra-dev/rspress/tree/main/e2e/fixtures/basic
Reproduce Steps
rspress.config.ts
export default defineConfig({ root: path.join(__dirname, 'doc'), markdown: { highlightLanguages: [ ['oc', 'objectivec'], ['mdx', 'tsx'], ], }, });