title: How do I Display Code Samples On Web Pages With Nice Syntax Styling Like Stack Overflow Does?
body: <p>I would like to be able to pull some code samples out of a database and/or have the text embedded into the website and then have the sample formatted in a code like fashion on the screen.  While the text alone on the screen is great, the format will make it more user friendly.  How is this done?</p>
  
  <p><strong>I want this:</strong><br><br>
  &nbsp;public string MyString = "The Sample Text";
  <hr>
  <strong>To look like:</strong></p>
  
  <pre><code>public string MyString = "The Sample Text";
  </code></pre>
  
  <p><hr>
  <strong>EDIT WITH ANSWER</strong><br>
  I took <a href="https://stackoverflow.com/questions/749209/display-code-samples-on-web-like-stackoverflow/749229#749229">Gortok's</a> suggestion and looked into <a href="http://code.google.com/p/google-code-prettify/" rel="nofollow noreferrer">Prettify.js</a> and its doing just what I had hoped.  Here is how this is implemented.</p>
  
  <pre><code>&lt;head runat="server"&gt;
      &lt;script src="Scripts/prettify.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="Scripts/jquery-1.3.2.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;link href="Scripts/prettify.css" rel="stylesheet" type="text/css"&gt;&lt;/link&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;code class="prettyprint"&gt; 
          public String HelloString = "New String"; 
      &lt;/code&gt;  
      &lt;script language="javascript"&gt; 
          $().ready(function() { 
              prettyPrint(); 
          }); 
      &lt;/script&gt; 
  &lt;/body&gt; 
  </code></pre>