Customize the syntax highlight for the specific programming language you are using in the browser or on the server using this library
What's new in Highlight.js 11.3.2:Grammars: Fix(python) Fix recognition of numeric literals followed by keywords without whitespace (#2985) Richard Gibson
Highlight.js is a syntax highlighter designed to work with quite a few programming languages and that functions equally well on the server and in the browser. According to the developer, the tool works with any markup, supports over 180 languages and does not rely on any framework. In fact, the app automatically detects the language you are currently using and, in case it is not the one you are using, there are numerous 3rd party plugins for this purpose.
As previously mentioned, the tool works in the browser or web workers and hence, can help you prevent freezing windows, especially when dealing with large chunks of code. To get started in the browser, all you need to do is link to the library along with one of the styles and calling. Following the linking, you should be able to find and highlight code inside of the <pre><code> tags. If the language is not automatically detected, then you can specify it in the class attribute.
The utility allows you to assign an initial value for a data value of variable, meaning that you can add any custom initialization you prefer. You can customize when it should be highlighted and when using the configure and highlightBlock functions.