简体   繁体   中英

C# Syntax Highlighter that outputs HTML

I'm looking for a C# syntax highlighter that will take my C# code and turn it into standalone HTML that is neatly tagged. I have found some websites that offer this but only output HTML that is coupled with a CSS stylesheet. If anyone knows if what I'm describing exists please gimme a link!

The Python tool Pygments looks like it can do what you want and much more besides. I believe it supports many languages, including C#.

  • a wide range of common languages and markup formats is supported
  • special attention is paid to details that increase highlighting quality
  • support for new languages and formats are added easily; most languages use a simple regex-based lexing mechanism
  • a number of output formats is available, among them HTML , RTF, LaTeX and ANSI sequences
  • it is usable as a command-line tool and as a library

When I last used it, I got standalone HTML from the CopySourceAsHtml plugin to Visual Studio. (I stopped using it only because I prefer the linked CSS approach.)

http://copysourceashtml.codeplex.com/

The appeal of this plugin is that it will match the styling of your Visual Studio theme, whatever that may be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM