title: Set the result of Html.Partial to a js string
body: <p>This is a simplified version of what I'm trying to accomplish:</p>
  <pre><code>@{
      Thing t = new Thing(); // create an object
      IHtmlString TV = Html.Partial(&quot;ThingView&quot;, t); // get html based on that model
  }
  &lt;script&gt;
      $(function(){
          var tv = &quot;@TV&quot;; // hold the html in a js variable
      }
  &lt;/script&gt;
  </code></pre>
  <p>However I get a javascript error:</p>
  <blockquote>
  <p>SyntaxError: unterminated string literal</p>
  <p>var tv = &quot;</p>
  </blockquote>
  <p>I understand the problem is the Html.Partial is generating html with a bunch of white space, and it's messing up javascript, however it seems like there should be a way to say <code>@TV.NoWhiteSpace()</code> or something.</p>
  <p>I've searched for a solution, but all I'm seeing are <a href="https://stackoverflow.com/questions/14506499/add-html-partial-to-javascript">Regex solutions</a>, which seems like a sloppy, and possibly mistake-ridden solution.</p>
  <p>Is there a cleaner or preferred way to do this?</p>