Posted 18 years ago
by Matt Adamson

Guys,
Firstly I really like the control, it's perfect to show source code files in an ASP.NET application.
I'd like to extend the control to allow certain lines to be highlighted in specific colours and was wondering how I could extend it. What would be the best approach?
I can certainly create a new web custom control in another assembly and derive from the CodeHighlighter class. Then override the Render method however although provides a way to add tags to the start and end I can't see how I can modify the generated HTML.
Even if I call the base Render method first, how could I modify the HTML in the middle e.g. for each line output?
Note I am aware of the GenerateHtmlInline method which exists however I would like to create a control so can simply drop it on the ASP.NET page. In any case even if I used this method would I have to parse the string text to obtain the HTML or could I use an ASP.NET control to parse into HTML controls?
Thoughts much appreciated.
Cheers
Matt
[Modified at 10/03/2007 02:31 PM]
Firstly I really like the control, it's perfect to show source code files in an ASP.NET application.
I'd like to extend the control to allow certain lines to be highlighted in specific colours and was wondering how I could extend it. What would be the best approach?
I can certainly create a new web custom control in another assembly and derive from the CodeHighlighter class. Then override the Render method however although provides a way to add tags to the start and end I can't see how I can modify the generated HTML.
Even if I call the base Render method first, how could I modify the HTML in the middle e.g. for each line output?
Note I am aware of the GenerateHtmlInline method which exists however I would like to create a control so can simply drop it on the ASP.NET page. In any case even if I used this method would I have to parse the string text to obtain the HTML or could I use an ASP.NET control to parse into HTML controls?
Thoughts much appreciated.
Cheers
Matt
[Modified at 10/03/2007 02:31 PM]