1. Matthias Günther
  2. pmwiki-syntaxlove-recipe

Overview

Syntax highlighting with good look and cool JavaScript-effects if you move your mouse over the code. You can turn on several different options.

Picture of the recipe

Questions Answered By This Recipe

How can I display highlighted code of several languages on my wiki?

Description

This recipe gives you the markup for embedding source code in your Wiki with syntax highlighting. Just follow the instruction of the installation.

Installation

  • download from source or via git git clone git@bitbucket.org:wikimatze/pmwiki-syntaxlove-recipe.git
  • unzip everything
  • make the following copy-tasks:
    • put syntaxlove.php to your cookbook directory
    • put syntaxlove directory in your public directory (normally pub/)
  • now you should have the following structure
    • cookbook/syntaxlove.php
    • pub/syntaxlove/
      • css/...
      • scripts/
  • add include_once("$FarmD/cookbook/syntaxlove.php);" after including the following in your config.php

    $Array_Syntaxlove = array("Bash" => "0", "CSharp" => "0", "Css" => "0", "Delphi" => "0", "Groovy" => "0", "Java" => "1", "JScript" => "0", "Perl" => "1", "Php" => "1", "Plain" => "0", "Python" => "1", "Ruby" => "1", "Scala" => "0", "Sql" => "0", "Vb" => "0", "Xml" => "0");

Usage

  • use the following markup on your wiki-pages: (:codestart ruby:) ... (:codeend:)
  • it is also possible to highlight certain lines, to disable wrapping and many other options: (:codestart ruby highlight='[2,4]' wrap='false':) ... (:codeend:)
  • other options are:
    • collapse (allows you to hide the code and display and 'expand' code snippet )
    • gutter (turn line number on or off)
    • highlight (mark special line)
    • toolbar (enable or disable the toolbar)`
  • to switch to another language just replace ruby with one of the following languages: bash, csharp, css, cpp, elphi, groovy, java, jscript (JavaScript), perl, php, plain, python, ruby, scala, sql, vb, xml

Configuration

There are the following styles: shThemeDefault, shThemeDjango ... (more can be found under syntaxlove/css). To define a new style just go in the syntaxlove.php file and configure the $syntax_style variable. Don't hesitate to develop your own style.

To turn on or turn off a language just set 1 (for on) or 0 (for off) in the $Array_Syntaxlove-variable.

Notes

Credits goes to Alex Gorbatchev.

See Also

Contributors

MatthiasGünther

Comments/Feedback

See Syntaxlove-Talk - your comments are welcome here!

Contact

Feature request, bugs, questions, and so on can be send to matthias.guenther@wikimatze.de. If you enjoy the script please leave your comment under Syntaxlove Users.

License

This software is licensed under the MIT license.

© 2011-2013 Matthias Guenther matthias.guenther@wikimatze.de.

/ vim: set ts=2 sw=2 textwidth=120: /