wordprss.com Posting Source Code 原來是這樣使用

原來 WordPress.com 申請的 Blog 上用來要張貼程式碼的 code tag。還真的沒什麼用處,看起來就跟使用 pre tag 效果一樣。

直到發現這個說明文件 Posting Source Code , 上面有說明如何在我們申請的 Blog 貼上 Source Code 。


#button {
    font-weight: bold;
    border: 2px solid #fff;


[sourcecode language="css"]
your code here

Plugin 支援哪此程式語言顯示及標籤內其它屬性的用途說明

The language parameter controls how the code is syntax highlighted. The following languages are supported:

    • actionscript3
    • bash
    • coldfusion
    • cpp
    • csharp
    • css
    • delphi
    • erlang
    • fsharp
    • diff
    • groovy
    • html
    • javascript
    • java
    • javafx
    • matlab (keywords only)
    • objc
    • perl
    • php
    • text
    • powershell
    • python
    • r
    • ruby
    • scala
    • sql
    • vb
    • xml

Configuration Parameters

The shortcodes also accept a variety of configuration parameters that you may use to customize the output. All are completely optional.

    • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
    • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
    • firstline (number) — Use this to change what number the line numbering starts at. It defaults to 1.
    • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true.
    • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example “4,7,19″.
    • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
    • light (true/false) — If true, the gutter (line numbering) and toolbar (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
    • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
    • toolbar (true/false) — If false, the toolbar containing the helpful buttons that appears when you hover over the code will not be shown. Defaults to true.
    • wraplines (true/false) — If false, line wrapping will be disabled. This will cause a horizontal scrollbar to appear for long lines of code.



WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s