Allow adding custom language grammars to provide syntax highlighting in code blocks #1706
novusnota
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The Mintlify's MDX parser produces syntax highlighting for various languages in Markdown code blocks through Shiki.
Through a Fine-grained Shiki Bundle, one can support additional languages on top of the default ones by simply specifying the relevant TextMate grammar files.
Thus, it'd be great if you could allow users support languages for their documentation needs. The best way for that is to be done in some composable manner, like simply by placing
.tmLanguage.jsonfiles in the end-user documentation repo — those files can then be discovered by Mintlify's CLI in the same way it discovers CSS and JS files (see Custom scripts). Then, the MDX parser would take them into account when processing code blocks.Alternative, simpler solution would be to manually provide custom grammar files right in the MDX parser repo. This comes with a benefit — those languages would be available for all Mintlify users. Blockchain programming language communities can really utilize that to produce awesome docs. However, this approach has a higher maintenence burden in the long run — many users would like their language to be featured and updated over time, increasing overall churn rate in the mintlify/mdx repo.
P.S.: When working with
.tmLanguage.jsonTextMate grammars in Shiki, as compared to their use in VSCode, Sublime Text, and similar editors, it's necessary to modify the"name"field. That is, names there should be lower-cased and have any hyphens or non-identifier characters removed. For example,"name": "TL-B"should become"name": "tlb", and so on.Beta Was this translation helpful? Give feedback.
All reactions