Table of Contents
Code Replacement Plugin
Compatible with DokuWiki
- 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
- general use
- for a header
<code|this is a header>some code</code>
Plugin has been tested in the following environments:
- DokuWiki 2006-03-05+
- Internet Explorer 6,7
- Opera 9.10, 9.21
- Safari/Windows 3.0.2
- Firefox 2.0.4
- 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
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:
- 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.
- 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?
- oddly, code3 adds a newline after any CSS comment within the
<code … </code>tags.
- 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.
- likewise, could there be an option to have a code block collapsed?
- 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.
- I had to modify the font sizes in
/lib/plugins/code/styles/styles.csssince the fonts looked too small on my browsers.
Oddly, I was able to get the code windows to display all of my code. Look at the (slightly convoluted)
/lib/plugins/code/script.jsfile, 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?