Joomla!, Wordpress tips for building your site

Joomla!, Wordpress tips for building your site

Syndicate this site using RSS

How to show source code highlight with WordPress

Published on| November 18th, 2009 | No Comment.

To highlight the WordPress source code is Yappari plug.
If WordPress is adding a feature is not available from only one of the themes or plug-in, plug Yappari.
In this respect, Joomla! The minute there is a plug-in modules and habitat isolation, after we become easier to manage.
(At first, you need to understand the habitat isolation it.)

Time, is pleased to introduce, WP-Syntax is a plug-in.

This plug-in, GeSHi plug-in with a very is good.(GeSHi is, php is using Kodohairaitaraiburari.)
The beta version so far is that the author is particularly問題Rashii could not be confirmed.
Contact download, Http://Wordpress.org/Extend/Plugins/Wp-Syntax/ is.

Immediately, try using.

Install the plug-in as normal Plugins- Add New- [Upload]From where to download from where you downloaded the ZIP file and install it.
After installation, enable the plug-in.

Then uses an embedded code in the article.

The following is an example of use.例 1: PHP, 行番号なし

<pre lang="php">
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\n";
  }
?>
</div>
</pre>

見え方

<div id="foo">
<?php
  function foo() {
    echo "Hello World!\n";
  }
?></div>

例 2: Java, 行番号あり

<pre lang="java" line="1">
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}
</pre>

見え方

1
2
3
4
5
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

例 3: Ruby, 行番号あり(開始行番号18行目を指定)

<pre lang="ruby" line="18">
class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

</pre>

見え方

18
19
20
21
22
class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

例 4: html エスケープコードを使う場合、オプションにescaped="true" 指定すると正しく表示できます。

<pre lang="xml" escaped="true">
&lt;xml&gt;Hello&lt;/xml&gt;
</pre>

Appearance

<xml>Hello</xml>

Add to your favorites(bookmarks): はてなブックマークへ追加するdel.icio.usLivedoor ClipYahoo!FC2Nifty ClipPOOKMARK. AirlinesBuzzurl(バザール)Choixnewsing

Trackback URL

After Admin approves this comment, it will be shown.


Comments

Leave a Reply





*