Does anyone know how or if its possible for Visual Studio 2008 to highlight the html syntax inside a script block of type "text/html" just like any other markup on an aspx/html page. I'm using the script block to house my templates for client-side templating.
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.
Two ideas come to mind, assuming the page itself is an ASP.NET page (and not a plain HTML page) :
script
tag and end-tag. By using a custom control, you'll fool the IDE into not knowing about the script
tag, and so you'll get the same syntax coloring as the enclosing page's HTMLI like the first option better, as it doesn't force you to split your page into multiple files.
If it's a plain HTML page, there's not many easy ways to do this. If "not easy" is OK, then you can alwasy create an HttpModule which replaces a placeholder tag in the source code (e.g. <myscript>
) with, upon output to the user, a real text/html script tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With