Link and Syntax Color an External Code Url

One common request for CodePaste.net has been to syntax color code retrieved from an external URL. The most common scenario for this feature is for Source Code repositories which typically display code as plain text. You can send these URLs to CodePaste.net and show them in the appropriate syntax highlighting.

There are a couple of ways to accomplish this. The easiest is to use the Web Code menu option which prompts for Url and syntax for a specific Url:

This HTML front end page is a simple form that produces a URL that you can also create by hand:

http://codepaste.net/ShowUrl?url=http%3A%2F%2Fwww.west-wind.com%3A8080%2Fsvn%2FWestwindWebToolkit%2Ftrunk%2FWestwind.Web%2FExtended%2FPager.cs&Language=C%23

This is pretty straight forward: You provide two query string values:


where language is C#,VB.NET,JavaScript,HTML,SQL,FoxPro,Java,CSS,HtmlPhp etc. and URL is the url to the raw text for the code.

Note that the Language should be URL encoded! Specifically remember that C# is C%23.


  Last Updated: 01/02/10 | © West Wind Technologies, 2010