It's better when it's simple

User Tools

Site Tools


processing Plugin

Compatible with DokuWiki

2005-09-22 and later.

plugin FIXME

Last updated on
Conflicts with

This extension is marked as obsoleted. Therefore it is hidden in the Extension Manager and the extension listing. Furthermore, it is candidate for removal.

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

Tagged with !obsolete, highlight, javascript, processing, syntax

Processing module used by this plugin is discontinued and deprecated.

About this plugin

Processing is an environment that is widely being used for interaction design, interactive installations, graphic art, artistic programming, etc… A subset of functions of the processing environment has been ported to a single javascript file called processing.js, which allows users to execute their code in a browser environment.

This plugin parses processing(java) code to the processing.js script (which for this plugin has been renamed 'script.js' to be compliant with the dokuwiki plugin format) and outputs the resulting java applet to the wiki, as well as the syntax highlighted sketch code.

The plugin is pretty much a 0.0001 release. Some example sketches work, but by far not all of them. Also a number of extra features would increase usability tremendously. Any help or contribution is highly appreciated


This plugin allows users to execute their own javascript within the wiki. Although the processing.js function set is pretty harmless (screen output, mouse capture, etc) executing user scripts can be vulnerable.

Download and Installation

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

Syntax and Usage

Using <processing> and </processing> a snippet of code is both highlighted and parsed trough to the Processing.js (included and renamed as script.js for plugin portability)

See for examples.

The plugin syntax file:

 * DokuWiki Plugin processing (Syntax Component)
 * @license GPL 2
 * @author  Edwin Dertien <>
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'syntax.php';
require_once DOKU_INC.'inc/geshi.php';
require_once DOKU_INC.'inc/parser/code.php';
class syntax_plugin_processing extends DokuWiki_Syntax_Plugin {
	function getInfo() {
	        return array('author' => 'Edwin Dertien',
                     'email'  => '',
                     'date'   => '2010-08-22',
                     'name'   => 'Processing code Plugin',
                     'desc'   => 'Include processing code and embedded processing.js applet',
                     'url'    => '');
    function getType() {
        return 'substition';
    function getPType() {
        return 'normal';
    function getSort() {
        return 100;
    function connectTo($mode) {
 function postConnect() {
 function handle($match, $state, $pos, &$handler){
 $width = 300;
 $height = 300;
      switch ($state) {
          case DOKU_LEXER_ENTER : 
          case DOKU_LEXER_MATCHED :
          case DOKU_LEXER_UNMATCHED :
          // ugly piece of string decomposition to get width and hight from the sketch
                $numbers = substr($match,strpos($match,"size(")+5,20);
                $width = trim(substr($numbers,0,strpos($numbers,",")));
                $height = trim(substr($numbers,strpos($numbers,",")+1,strpos($numbers,");")-strpos($numbers,",")-1));
                return array($state,$match,$width,$height);
          case DOKU_LEXER_EXIT :
          case DOKU_LEXER_SPECIAL :
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){
        list($state, $match,$width,$height) = $data;
        switch ($state) {
        case DOKU_LEXER_ENTER :
        case DOKU_LEXER_UNMATCHED :	 
       $renderer->doc .=
  		"<script type=\"application/processing\">".
        "</script><canvas width=\"".
        "\" height=\"".
        $renderer->doc .= "<br>build with <a href=\"\">processing</a> and <a href=\"\">processing.js</a><br>";
        case DOKU_LEXER_EXIT :
            return true;
        return false;

Bugs, feature requests

  • The java-applet is not parsed into a slideshow (s5). Anyone hints in a direction how to start solving this?
  • giving the download-link at the top of the highlighted code using $renderer→code($match,“java”,“filename.txt” gives a 404 link. Anyone hints how to fix this?
  • make source collapsible
  • not every processing sketch can be executed. Is there a way to include the *.js sources on top of the page?
  • check vulnerability?
plugin/processing.txt · Last modified: 2022-01-29 19:46 by Klap-in

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