Thursday, April 21, 2011

Syntax Highlighter

A kind word is like a Spring day.~ Russian ProverbImage by ZedZaP Syntax Highlighter by Alex Gorbatchev’s



Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

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 true, line line wrapping will be disabled. This will cause a horizontal scrollbar to appear for long lines of code.
Here’s some examples of the above parameters in action:



[sourcecode language="sql"]
SQL> shutdown abort
ORA-01031: insufficient privileges
[/sourcecode]
     
OUTPUT:
1SQL> shutdown abort
2ORA-01031: insufficient privileges
Below code would start the line number from 10 and highligh line number 14 and 15
[sourcecode language="sql" firstline=10 highlight = 14,15] C:\Users\ACE>sqlplusSQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 5 19:52:01 2011 Enter user-name: sys as sysdba Enter password: Connected. SQL> shutdown immediate ORA-24324: service handle not initialized ORA-24323: value not allowed ORA-01090: shutdown in progress - connection is not permitted [/sourcecode]


OUTPUT:

10C:\Users\ACE>sqlplus
11SQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 5 19:52:01 2011
1213
14Enter user-name: sys as sysdba
15Enter password:
16Connected.
17SQL>  shutdown immediate
18ORA-24324: service handle not initialized
19ORA-24323:  value not allowed
20ORA-01090: shutdown in progress - connection is not  permitted






http://en.support.wordpress.com/code/posting-source-code/
Enhanced by Zemanta

No comments:

Post a Comment