This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

wp-syntax-rettke

Description

Out of the box, WP-Syntax
colors code using the default GeSHi colors.
Per the authors advice in the ‘Advanced Customization’ section of
Other Notes,
you can configure GeSHi yourself by handling the wp_syntax_init_geshi
hook and configuring it programmatically.

Since I wanted to do just that, I decided to publish a generic plugin
for folks who wanted to configure GeSHi following this approach.

Release Notes

1.2 : Set keyword expansion in the plugin file. Uses Wp-Syntax 0.9, which depends on GeSHi 1.0.7.22.

1.1 : Fixed grammatical errors in the readme.txt. Uses Wp-Syntax 0.9, which depends on GeSHi 1.0.7.22.

1.0 : First public release. Uses Wp-Syntax 0.9, which depends on GeSHi 1.0.7.22.

Screenshots

  • Scheme, an alternate syntax for let.
  • Scheme, a non-hygienic, anaphoric macro.
  • Scheme, an Ruby-like loop syntax.

Installation

  1. Upload wp-syntax-rettke.zip to your WordPress plugins directory,
    usually /wp-content/plugins/ and unzip the file. It will create a /wp-content/plugins/wp-syntax-rettke/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Create a post/page that contains a code snippet following the proper usage syntax.

FAQ

Why is your theme so sparse?

I don’t like distractions.

My blog has a black and white theme, so I don’t want any colors in the syntax
highlighting. The formatting that I care about the most is for Lisp.

When reading Lisp (as opposed to writing it), I find that bold brackets and
italic comments make it very easy to follow the structure and flow.

Taking the theme a little further, I also configured the wp-syntax.css to
use SmokeWhite colored borders, and tweaked the GeSHi scheme.php
configuration to better reflect how you really code in Scheme (both are included
as examples).

How should I change the settings of the API calls?

You may customize the GeSHi settings manually in wp-syntax-rettke.php
using whatever method you prefer. One option for doing so is using the built
in ‘Plugin Editor’. If you want to use the ‘Plugin Editor’, you should set
permissions on wp-syntax-rettke.php to ‘666’. I keep the file under version
control, so I make my changes locally and ftp them to the server.

Where do I start?

Go the GeSHi demo page and play
around with the settings to get a idea of what you can change.

How do I know what GeSHi API calls to make?

Read the GeSHi API Documentation
and look for the call in there. Once you find it, double check that the call
hasn’t changed or been deprecated by going right to the source: download
the version of GeSHi listed in the release notes for this plugin. Then have a
look at geshi.php.

How do I make my changes take effect?
  1. Deactivate this plugin.
  2. Apply your change (see How should I change the setting of API calls?).
  3. Activate this plugin.
  4. Your change should apply immediately upon reloading the test page of your choosing.
The API calls are not changing the highlighting in the manner that I expect it to be changed. What should I do?

Some of the API calls appear to be too general, or vague. Take, for example,
set_keyword_group_style.

You can specify the number for any group, and while the groups are discussed in
the documentation (see Setting Keyword Styles),
even there it is not very clear what tokens show up in
what group. This, is by design.

The language formatting configuration file
authors are free to put whatever tokens into whatever groups they wish. So,
if you are not getting the results you desire for a particular languge, then
you need to go right to the language file itself
(located in /wp-content/plugins/wp-syntax/geshi/geshi/<your-lang>.php)
to figure out which group you should be setting, but are not setting,
and make the change.

What if I don’t like how Wp-Syntax works?

Then you need to go the the
WP-Syntax Website.
They’ve got great forums and documentation there.

What if I don’t like how wp-syntax-rettke works?

The best thing for you to do is to use my theme as a template, follow my
notes, and create a theme of your own!

What if I don’t like how GeSHi parses my code?

You’ve got the option to tweak the language files yourself. They are located
in /wp-content/plugins/wp-syntax/geshi/geshi/<your-lang>.php. The process is quite simple, you will get
great results in no time.

Contributors & Developers

“wp-syntax-rettke” is open source software. The following people have contributed to this plugin.

Contributors