Skip to content
Discussion options

You must be logged in to vote

Typically, the file extension will be the name or an alias of the corresponding language is Prism. For example, the py, js, ts, cs, c, cpp, html, css, java, php, sql, and many more file extensions can be used as the code language directly. Any exceptions to this can be placed in a map, and then you fallback to the file extension. The code example below illustrates what I mean.

const fileExtensionLangMap: Record<string, string | undefined> = {}

const getLanguage = (fileExtension) => {
  return fileExtensionLangMap[fileExtension] ?? fileExtension
}

is there a mapping somewhere from extensions to supported language?

All extensions support all languages. Autocompletion has to be registered…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Madd0g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants