Plugin Directory

WP-SynHighlight

Usage

Surround your code directly in WYSIWYG editor with a [codesyntax] [/codesyntax] tag like this

[codesyntax lang="php"]

<?php 
//Replacing tags
$find [] = '/<br\s*\\?>/i';
$replace [] = "\r\n";
$content = preg_replace($find, $replace, $content);
?>

[/codesyntax]

and you will get wonderful geshi formatting. Format all your source code with Preformatted style to preserve spaces.

Plugin recognizes several popular geshi options to render highlighting:

lang

The programming language you want to be your source highlighted in. [codesyntax lang="java"]My java code goes here...[/codesyntax] The name of the language should match the name of the highlighter file. For the list of all supported highlighters please look at /wp-content/plugins/wp-synhighlighter/geshi/geshi directory of your WordPress installation after installing this plugin. A list of currently support languages:

abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, cil, cobol, cpp-qt, cpp, csharp, css, c_mac, d, delphi, diff, div, dos, dot, eiffel, email, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, list.txt, lotusformulas, lotusscript, lua, m68k, make, matlab, mirc, mpasm, mxml, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, perl, php-brief, php, pic16, plsql, povray, powershell, progress, prolog, python, qbasic, rails, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, visualfoxpro, winbatch, xml, xorg_conf, xpp, z80

lines

Do you want line numbers to be visible? Possible parameter values are:

  • no - no line numbers. [codesyntax lang="java" lines="no"]My java code[/codesyntax]
  • normal = normal line numbering
  • fancy - fancy line numbering This parameter defaults to fancy

lines_start

You can provide this parameter if you want your line numbering to start with a custom value. [codesyntax lang="java" lines="fancy" lines_start="1000"]My java code[/codesyntax]. Please don't forget to enclose a value into quotes exactly like in example By default numbering starts with 1.

container

You can select container, that your code will be wrapped in

  • pre
  • div
  • pre_valid
  • pre_table
  • none

By default pre is used. [codesyntax lang="java" container="pre"]My java code[/codesyntax] More information can be found in Geshi documentation

capitalize

Do you wish your keywords to be automatically capitalized or decapitalized?

  • no - don't change anything
  • upper - convert all keywords into uppercase
  • lower - convert all keywords into lowercase By default no change is assumed [codesyntax lang="java" capitalize="upper" lines_start="1000"]

tab_width

If you want to change tab width, use this parameter: [codesyntax lang="java" tab_width="10"]

strict

This setting enables or disables strict mode for formatting complex pieces of data. Please see Geshi documentation to find out more on the subject

title (new in 0.91)

This attribute sets the header of the collapsable code block ("Code" by default)

bookmarkname (new in 0.91)

The name of bookmark (Named anchor tag <a name="bookmarkname" />) you want to refer to this codeblock. By default it is codesyntaxX, where X is 1 for first code block on the page, 2 for second etc. You can refer to your codeblocks using hyperlinks < a href="#codesyntax5">Link to fifth code block on the page or, if you used [codesyntax bookmarkname="fifthcode"] lang="php" bbcode, you can then refer to this codeblock as
< a href="#fifthcode">Link to fifth code block on the page

Version history

0.963

  • Another Unicode three-dots symbol presentation fixed

0.962

  • Another Unicode double-dashes symbol presentation fixed

0.961

  • Another Unicode quote-like symbol presentation fixed

0.96

  • UI added for convinient selecting all codesyntax tag options
  • Code is now correctly trimmed preventing nasty newlines from appearing
  • Bug fixed with non-latin code titles

0.94

  • css stylesheet problem with incorrect displaying short code fragments fixed. Thanks to Warun Kietduriyakul for reporting a bug.
  • inove theme css stylesheet problem fixed. Thanks to Warun Kietduriyakul for reporting a bug.

0.93

  • css stylesheet path problem fixed. Thanks to Warun Kietduriyakul for reporting a bug.

0.92

  • Editor button for GUI mode fixed at last and is working ok now. I am sorry for this bug.

0.9

  • Editor button for GUI mode
  • Syntax highlighting in comments
  • Collapsable code area with customizable css
  • New options for bbcode: title and bookmarkname

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data
100,1,1

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(3 ratings)