If you frequently read or write coding articles on Medium you’ll know that it hasn’t had any syntax highlighting support for years now, despite programming being one of the most common topics on the platform. Software writers have had to resort to third-party tools to produce beautiful code highlighting that enhances readability.
Luckily, all that should change soon, as recently the Medium team finally added built-in syntax highlighting support to the code block for major programming languages.
As you can see in the demo, the code block can now automatically detect the code’s language and highlight it.
Manual syntax highlighting
For tiny code snippets, auto-detection will likely fail:
In such a case you can select the correct language from the drop-down list:
Remove syntax highlighting
If the code is of a language not listed or it doesn’t require highlighting, you can select
None and remove the highlighting.
Note that syntax highlighting isn’t applied to articles published before the feature arrived, probably because it would produce incorrect results in them if auto-detection failed.