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?
I want this:
 public string MyString = "The Sample Text";
public string MyString = "The Sample Text";
<head runat="server">
    <script src="Scripts/prettify.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
    <link href="Scripts/prettify.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
    <code class="prettyprint"> 
        public String HelloString = "New String"; 
    </code>  
    <script language="javascript"> 
        $().ready(function() { 
            prettyPrint(); 
        }); 
    </script> 
</body> 
                Stack Overflow uses prettify.js from Google.
I use SyntaxHighlighter by Alex Gorbatchev
http://alexgorbatchev.com/wiki/SyntaxHighlighter
It's used on Yahoo Developer Network
http://developer.yahoo.com/yui/animation/
would this help:
http://code.google.com/p/syntaxhighlighter/
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