6

Is there a c# library that can help to write and indent Javascript code.

It's because I'm writing some c# code that generated some Javascript code. Something like this :

js += "<script type=\"text/javascript\">\n";
js += "   function()...\n";

And I find that generated a lot of ugly code.

So, I thought that maybe a existing library can help me doing that ?

1
  • 2
    Perhaps it would be easier to write out unformatted code then simply run the result through a beautifier (tons of these available online). Commented Mar 19, 2010 at 2:12

2 Answers 2

2

I just found this.

http://projects.nikhilk.net/ScriptSharp

Sign up to request clarification or add additional context in comments.

Comments

0

ScriptSharp looks interesting but has a fairly high learning curve.

I wrote this a long time ago which is simple and was popular at the time (which amused me because I wrote it to simplify some other articles rather than as an article in its own right). Don't know how well it stands up nowadays though; I haven't used it in a long time. I prefer to keep scripts out in their own files now.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.