Search code examples
language-agnosticprettify

How to prettify programming language


I have code written in any programming language. How can I "prettify" it (bold if, else etc.) to display on a website? Are there any good APIs to do that?


Solution

  • There is Google's prettify which is widely used for such tasks (e.g. SO itself uses it for highlighting of code).

    Google Code Prettify JavaScript library supports all C-like (Java, PHP, C#, etc), Bash-like, and XML-like languages without need to specify the language and has customizable styles via CSS.

    Moreover, as i know, there is a lot of third-party styles for those languages that not supported officially.