I’ve been using st.code for a while now and I’ve been trying to highlight C++ and C# code but I couldn’t find anywhere that tells you the languages that st.code supports. Could anyone tell me what languages the syntax highlighting supports and their keynames?
Hi @Bob_Chesterton , welcome to the Streamlit community!
That’s a really good question! st.code uses the react-syntax-highlighter NPM package for syntax highlighting. The list of available languages are available here (includes C but does not support C++ or C#):
A PR with a fix to the st.code docs is on its way:
streamlit:develop ← snehankekre:code-highlight-list
opened 06:55AM - 25 Jul 22 UTC
## 📚 Context
The `st.code` [docstring](https://docs.streamlit.io/library/api-… reference/text/st.code) has a `language` parameter for syntax highlighting. The docs don't include a list of all supported languages.
[CodeBlock.tsx](https://github.com/streamlit/streamlit/blob/develop/frontend/src/components/elements/CodeBlock/CodeBlock.tsx) uses the [react-syntax-highligher](https://www.npmjs.com/package/react-syntax-highlighter) NPM package for syntax highlighting and the available `language` imports are listed [here](https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD).
- What kind of change does this PR introduce?
- [ ] Bugfix
- [ ] Feature
- [ ] Refactoring
- [x] Other, please describe: Doc improvement request
## 🧠 Description of Changes
- Added a [link](https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD) in the st.code docstring to the list of all available language imports
- Fixes reStructuredText inline code formatting in st.markdown docstring
- [ ] This is a breaking API change
- [x] This is a visible (user-facing) change
**Revised:**

**Current:**

## 🧪 Testing Done
- [x] Screenshots included
- [ ] Added/Updated unit tests
- [ ] Added/Updated e2e tests
## 🌐 References
_Does this depend on other work, documents, or tickets?_
- **Issue**: Closes #5028
---
**Contribution License Agreement**
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.