Syntax Highlighting

alt ratio-2x2 It's 100% Java Script based and it doesn't care what you have on your server.

The two blocks below, "source" and "result" are generated dynamically by SyntaxHighlighter from regular <pre /> HTML tags. If you want to see a specific syntax in action, check out the bundled syntaxes page.

Source:

  
          <pre class="brush: php; highlight: [5, 15]; html-script: true">
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
          <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <title>SyntaxHighlighter Demo Page - <?= htmlspecialchars($title) ?></title>
          </head>

          <body>

          <?
          /***********************************
           ** Multiline block comments
           **********************************/

          $stringWithUrl = "http://alexgorbatchev.com";
          $stringWithOutUrl = 'hello world';

          ob_start("parseOutputBuffer");      // Start Code Buffering
          session_start();

          function parseOutputBuffer($buf) {
              global $portal_small_code, $portal_gzcompress;
              global $PHP_SELF, $HTTP_ACCEPT_ENCODING;

              // cleaning out the code.
              if($portal_small_code && !$portal_gzcompress) {
                  $buf = str_replace("   ", "", $buf);
                  $buf = str_replace("\n", "", $buf);
                  $buf = str_replace(chr(13), "", $buf);
              }
          }

          ?>

          <!-- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -->

          </body>
          </html>
          </pre>
      

Result:

  
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
          <head>
              <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              <title>SyntaxHighlighter Demo Page - <?= htmlspecialchars($title) ?></title>
          </head>

          <body>

          <?
          /***********************************
           ** Multiline block comments
           **********************************/

          $stringWithUrl = "http://alexgorbatchev.com";
          $stringWithOutUrl = 'hello world';

          ob_start("parseOutputBuffer");      // Start Code Buffering
          session_start();

          function parseOutputBuffer($buf) {
              global $portal_small_code, $portal_gzcompress;
              global $PHP_SELF, $HTTP_ACCEPT_ENCODING;

              // cleaning out the code.
              if($portal_small_code && !$portal_gzcompress) {
                  $buf = str_replace("   ", "", $buf);
                  $buf = str_replace("\n", "", $buf);
                  $buf = str_replace(chr(13), "", $buf);
              }
          }

          ?>

          <!-- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -->

          </body>
          </html>
      

Recent Posts

Flickr Stream

Text Widget

Aliquam eget arcu nec nisl imperdiet semper mollis sit amet tortor. Ut ultrices pharetra urna id cursus. Aenean ligula dolor, mollis id eros id, hendrerit malesuada nisi. Suspendisse et pellentesque est. In lobortis velit nec diam sodales, vel gravida nibh porta. Curabitur faucibus lacus ac tellus faucibus posuere. Nam lobortis