DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:jquery-syntax

jQuery.Syntax Plugin

Compatible with DokuWiki

Lemming, Anteater, Rincewind, Angua

plugin Extreme client-side syntax highlighting

Last updated on
2012-06-01
Provides
Syntax, Action
Repository
Source
Conflicts with
code, code2, code3

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to code, code2, code3, codeprettify, highlightjs, syntaxhighlighter

Tagged with client-side, code, syntax, syntaxhighlight

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Syntax and Usage

jQuery.Syntax is an extremely fast and lightweight syntax highlighter. It has dynamic loading of syntax source files and integrates cleanly using CSS or modelines.

Please see the main project page (via web.archive.org) for examples, compatibility, and free cake!

Transparently replaces <code> and <file> tags, as per most other code style plugins.

<code php-script> php script goes here </code>

Discussion

Online Interpreter

if you replace

toolbar.append('<a href="http://www.oriontransfer.co.nz/software/jquery-syntax"

with

toolbar.append('<a href="http://codepad.org" target="oriontransfer">!</a>');toolbar.append('<a href="http://www.oriontransfer.co.nz/software/jquery-syntax" target="oriontransfer">?</a>')

you can provide a link to an online-Interpreter

Fixing the Media Manager / Image Insertion

As at 2012-07-26, the latest version (2012-06-01) of jquery syntax highlighting plugin messes with the jQuery that comes with DokuWiki 2012-01-25 “Angua”, and this prevents image insertion via the Media Manager to work. Since I couldn't find an issue tracker associated with this plugin, I'll stick the bug report and its fix here.

Steps to Reproduce

  1. Edit a page
  2. Click the picture icon to insert an image
  3. Click on an image in the window which opens

Observed: Nothing visible to use happens, error appears in console

Expected: Popup dialog appears which allows user to set link target, alignment and size of image

Analysis: Looks like jQuery from DokuWiki gets clobbered by the jQuery which jquery-syntax adds. The variable $updateVersion is not passed to the popup Media Manager window.

Fix: Prevent jquery-syntax in the Media Manager window from loading its own version of jQuery: in dokuwiki/lib/plugins/jquerysyntax/action.php, add

	if (empty($updateVersion)) return false;

before

	if ($updateVersion < 36.0) {
	        $event->data['script'][] = array(
	                'type'    => 'text/javascript',
	                'charset' => 'utf-8',
	                '_data'   => '',
	                'src'     => $plugin_root.'/jquery-1.6.min.js'
	                );
	        $noConflict = "jQuery.noConflict();";
	}

After doing this, the image insertion works as expected and syntax highlighting still works. Tested using DokuWiki 2013-05-10a “Weatherwax”.

Caspar Krieger, updated by s.sahara 2013-09-22

plugin/jquery-syntax.txt · Last modified: 2023-12-21 19:35 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki