title: How to print @code section of a Razor page to the HTML view?
body: <p>I'm experimenting with Blazor for WebAssembly, and am looking for help with achieving something I found simple in basic JavaScript/HTML.</p>
  
  <p>If I have a code section in an HTML page, in a script tag, I can easily show that section of code in my HTML view by setting the innerHTML of some element, say a div, to the innerHTML of that script tag. Like: </p>
  
  <pre><code>&lt;div id="content" onload="fillDivWithCode()"&gt;&lt;/div&gt;
  &lt;script id="code"&gt; function foo() { return "bar"; } &lt;/script&gt;
  &lt;script&gt; 
    fillDivWithCode() {
      var div = document.getElementById("content");
      var codeScript = document.getElementById("code");
      div.innerHTML = codeScript.innerHTML;
      // now the entire contents of the "code" script will be shown in the DOM
    } 
  &lt;/script&gt;
  </code></pre>
  
  <p>However, say I want to do something similar in Blazor; how can I do it? For example, say my Razor page looks like</p>
  
  <pre><code>@page "/"
  &lt;div id="content"&gt;&lt;/div&gt;
  
  @code {
    private int currentCount = 0;
  
    private void IncrementCount()
    {
      currentCount++;
    }
  }
  </code></pre>
  
  <p>I want to display inside the "content" div the entire code in the @code section -- can this be done? If so, how?</p>