DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:code3

Code Replacement Plugin

Compatible with DokuWiki

2006-03-05+

plugin Client-side syntax highlighting

Last updated on
2008-02-02
Provides
Syntax
Conflicts with
jquery-syntax

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

Tagged with code, syntax, syntaxhighlight

This plugin is identical to code by Chris Smith (actually, I've copy-pasted code from his plugin). Demo page and some docs(Russian): http://debugger.ru/projects/psyhi/psyhi

Features

  • does code coloring on the client side
  • it uses Google Code Prettify library (patched, although)
  • client controllable line numbering of code (line numbering on/off)
  • client controllable open/collapse code blocks
  • client controllable viewing/manual highlight and copy
  • copy all code in a block in one click with clipboard copy button
  • looks professional

Usage

  • general use

<code> some code</code>

  • for a header

<code|this is a header> some code</code>

Compatibility

Plugin has been tested in the following environments:

  • DokuWiki 2006-03-05+
  • Browsers
    1. Internet Explorer 6,7
    2. Opera 9.10, 9.21
    3. Safari/Windows 3.0.2
    4. Firefox 2.0.4

Installation

Download the code.zip file (24Kb) and unpack it into lib/plugins folder or use the plugin manager.

screenshot

Changelog

Back To The Future: 2008-08-01 :)

  • 2008-08-01 Version 1.2:
    • fixed text copying
    • added newlines recognition in markup mode
    • fixed insertion of empty comment lines
  • 2008-08-01 Version 1.1:
    • added newlines recognition
    • fixed occasional deletion of unknown tokens
  • 2007-27-06 Version 1.0:
    • first public release
    • PSyHi v0.3 used

Discussion

How do I use this? I do understand Russian, is there any documentation in English?
All the required docs are placed here. You have to install this plugin, then it will take over <code> tags processing from the original code plugin. — Ilya Lebedev 2008-02-17 22:34

The Button`s couldn't be viewed correct with Camino (1.5.4).


:!: I like this plugin quite a bit! There are some issues I have, though:

  1. for me, the first line of code has to begin on the same line as the <code> tag or the line numbering is off by 1. If I start my code on the next line, then line number 1 is left blank.
  2. opening or closing brackets or parenthesis at the very beginning of a line (in my code) are chopped out! This isn't a big deal since all I have to do is add a space before the bracket or parenthesis… Could this be fixed?
  3. oddly, code3 adds a newline after any CSS comment within the <code … </code> tags.
  4. could there be an option to control the size of the code window? My code windows seem to vary depending on the size of the code they display. They always seem to show 85-95% of the code only. See below.
  5. likewise, could there be an option to have a code block collapsed?
  6. could there be an option for a footer to describe the code window? something like div.Controls span.stats, except at the bottom left of the code box? Well, on second thought maybe I can be happy with just the header.
  7. I had to modify the font sizes in /lib/plugins/code/styles/styles.css since the fonts looked too small on my browsers.

Juice 2008-08-15

Oddly, I was able to get the code windows to display all of my code. Look at the (slightly convoluted) /lib/plugins/code/script.js file, then add a single space right between these two divs:
<div class=\"CodeContainer\"><div class=\"TextContainer\">

This isn't exactly the fix I was looking for, though…
It would be nice to have (maybe) 3 options: have the code box closed, display all the code (what I'm doing now), or display 1-5 lines of the code with a scroll bar. Juice 2008-08-18


How can I control the first line number such as 0346 → 0347 → 0348?

plugin/code3.txt · Last modified: 2016-01-24 19:17 by Aleksandr