Syntax Highlighting on Slack
How to do syntax highlighting on Slack. Part of our Slack mini series
I’ve previously written before about simple formatting on Slack but what if you want to add syntax highlighting?
Say you want to share a block of Ruby code with a colleague and a simple code block just won’t cut it?
Here is how you can add a text snippet with syntax highlighting:
- Start typing
/snippet
- From the “create a text snippet” screen, add your text
- Select the language you want to use for syntax highlighting
- Press “create snippet”
The old solution
If you’re somehow still on a very old version of their cient, this might still work. It worked for us when we wrote this article back in 2017!
If you click on the +
symbol at the side of the text entry box, you will see an option for Code or text snippet
, click on this. A pop out will appear. You can paste or type your code block into the large text input box. Then if you click on the drop down in the top right corner, you can select the language you’d like to format to. It has many popular languages such as C#, JavaScript, and HTML. It also has a text wrap option. From this view you can choose which room you’d like to share the code snippet.
This article is a part of the "Slack" series
- Slack Shortcuts
- Setting Reminders on Slack
- Accessibility Options on Slack
- Making Custom Emojis on Slack
- Setting Your Status on Slack
- Shrugging on Slack
- Formatting on Slack
- Making a Channel on Slack
- This Article
- Custom Startup Messages on Slack
- Adding an integration to a Slack room
- Integrating RSS feeds to Slack (including YouTube)