Tuesday, September 6, 2011

วิธีโพส source code บน google blogspot

  1. หลังจาก sign in แล้วให้คลิ๊กเลือก Design บนแถบควบคุม จากนั้นเลือก Edit HTML
  2. ที่แถบ Edit Template ให้ copy โค้ดด้านล่างนี้ไปวางไว้ก่อนหน้าแทก </head>
  3. <link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" 
        rel="stylesheet" type="text/css"/>
    <script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"
        type="text/javascript"/>
  4. สุดท้ายให้เพิ่มโค้ดเข้าไปที่ body จะได้ว่า
  5. <body onload='prettyPrint()'>
  6. ถึงจุดนี้เราก็จะสามารถแสดง source code โดยใช้ pre แทกซึ่งเรียกใช้ผ่านคลาส prettyprint ดังตัวอย่างตามโค้ดด้านล่าง
  7. <pre class="prettyprint">
    source code
    </pre>

No comments:

Post a Comment