Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command-line tool to syntax highlight C# into HTML?

I'm looking for an easy way to syntax highlight C# code into HTML from the command line. Ideally this would be something like:

syntax-highlighter test.cs

... produces test.html.

like image 473
alejandro5042 Avatar asked Jan 19 '11 17:01

alejandro5042


People also ask

How do you highlight syntax?

Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.

How do I enable syntax highlighting?

After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.

Does bash have syntax highlighting?

bashrc seems to be syntax highlighted automatically, even though I haven't told Emacs to do that.

Does VS code have syntax highlighting?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.


1 Answers

A very good one is pygments.

The command is

pygmentize -f html /path/to/test.cs

Supports lots of languages, including C#. Requires python.

like image 101
kikito Avatar answered Oct 26 '22 23:10

kikito