「Code syntax testing」:修訂間差異

出自DILA Wiki
imported>Simon
無編輯摘要
imported>Simon
無編輯摘要
 
(未顯示同一使用者於中間所作的 10 次修訂)
行 1: 行 1:
- simple code tag (e.g. <php> echo "Hello World"; </php>)
I've written a Syntax Highlighter plugin for our Wiki.  There are some example of how to use it below.  The hard work is done by the [http://qbnz.com/highlighter/ GeSHi] syntax highlighting engine - I've simply created a wrapper-plugin.  I haven't implemented all of GeSHi's functionality - if there's a feature you'd like to use, let me know and I'll add it.  Things I could add easily if it would help include highlighing certain lines for emphasis, and specifying the line-number to begin at.  For now, note that 'n' will give line-numbers.  See below for more details.
 
謝謝!
 
Simon
 
[edit:]
see also [http://blogs.ddbc.edu.tw/blog/2008/09/08/syntax-highlighting/ here] - this uses a different system, but I'm not sure which is better...
 
--------------
 
- simple-style code tag (e.g. <php> echo "Hello World"; </php>)
<php> echo "Hello World"; </php>
<php> echo "Hello World"; </php>




- advanced code tag (e.g. &lt;code php&gt echo "Hello World"; &lt;/code&gt)
- advanced-style code tag (e.g. &lt;code php&gt; echo "Hello World"; &lt;/code&gt;)
<syntaxhighlight lang="PHP"> echo "Hello World"; </syntaxhighlight>
<syntaxhighlight lang="PHP"> echo "Hello World"; </syntaxhighlight>




- advanced code tag with line numbers (&lt;code php n&gt echo "Hello World"; &lt;/code&gt)
- advanced-style code tag with line numbers (&lt;code php n&gt; echo "Hello World"; &lt;/code&gt;)
<syntaxhighlight lang="PHP" line> echo "Hello World"; </syntaxhighlight>
<syntaxhighlight lang="PHP" line> echo "Hello World"; </syntaxhighlight>




- default code tag (e.g. &lt;code&gt echo "Hello World"; &lt;/code&gt)
- default code tag (e.g. &lt;code&gt; echo "Hello World"; &lt;/code&gt;)
<syntaxhighlight lang="XML"> echo "Hello World"; </syntaxhighlight>
<syntaxhighlight lang="XML"> echo "Hello World"; </syntaxhighlight>




- display a list of supported languages (e.g. &lt;code list&gt&lt;/code&gt)
- the list of supported languages (available by calling: &lt;code list&gt;&lt;/code&gt;  note: if you use an invalid keyword or invalid syntax, the plugin will return this list)
 
 
<syntaxhighlight></syntaxhighlight>
<syntaxhighlight></syntaxhighlight>

於 2008年9月15日 (一) 11:34 的最新修訂

I've written a Syntax Highlighter plugin for our Wiki. There are some example of how to use it below. The hard work is done by the GeSHi syntax highlighting engine - I've simply created a wrapper-plugin. I haven't implemented all of GeSHi's functionality - if there's a feature you'd like to use, let me know and I'll add it. Things I could add easily if it would help include highlighing certain lines for emphasis, and specifying the line-number to begin at. For now, note that 'n' will give line-numbers. See below for more details.

謝謝!

Simon

[edit:] see also here - this uses a different system, but I'm not sure which is better...


- simple-style code tag (e.g. <php> echo "Hello World"; </php>) <php> echo "Hello World"; </php>


- advanced-style code tag (e.g. <code php> echo "Hello World"; </code>)

 echo "Hello World";


- advanced-style code tag with line numbers (<code php n> echo "Hello World"; </code>)

 echo "Hello World";


- default code tag (e.g. <code> echo "Hello World"; </code>)

 echo "Hello World";


- the list of supported languages (available by calling: <code list></code> note: if you use an invalid keyword or invalid syntax, the plugin will return this list)