dimanche 16 juin 2013

how to use Google-code-prettify

in this tutorial I will show you how to use Google-code-prettify :
for more informations you can visit this Page :
      http://code.google.com/p/google-code-prettify/

To put a pretty code to your blog , try to follow this few steps :
  1. Include the script tag below in your document,You can load the JavaScript and CSS for prettify via one URL:
    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
    
    

  2. Marking code sections : Put code snippets in    <pre class="prettyprint"> ...</pre> or <code class="prettyprint">...</code> and it will automatically be pretty printed.

  3. How do I specify the language of my code?  You don't need to specify the language since prettyprint() will guess. You can specify a language by specifying the language extension along with the prettyprint class like so:

         <pre class="prettyprint lang-html">
    The lang-* class specifies the language file extensions.
    File extensions supported by default      include"bsh", "c",
     "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html","java",
     "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
    "xhtml", "xml", "xsl".
    </pre>
    

1 commentaire:

  1. May you show me what extension for sql
    I had use "m", but don't hightlight code, Thanks a lot!
    http://learn-tech-tips.blogspot.com/2015/05/registration-form-php-SQL.html

    RépondreSupprimer