GeSHi

GeSHi is an open source syntax highlighting tool written in PHP. This Enano plugin extends the <code> tag to support a total of 138 languages.

The plugin works under Enano 1.1.x.

Usage:

<code type="bash">
echo "This is some bash script that will be syntax highlighted!"
</code>

This will result in:

echo "This is some bash script that will be syntax highlighted!"

There is some alternate syntax supported (<source lang="foo"> instead of <code type="foo">) for compatibility with other wikitext formats. However the official method is the one used on this page.

Supported values for the type attribute are: abap, actionscript3, actionscript, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, caddcl, cadlisp, cfdg, cfm, cil, c_mac, cmake, cobol, c, cpp, cpp-qt, csharp, css, dcs, delphi, diff, div, dos, dot, d, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html, idl, ini, inno, intercal, io, java5, java, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, perl, per, php-brief, php, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vbnet, vb, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, and z80.

Demos

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <title>Password strength scoring</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="pwstrength.js"></script>
  </head>
  <body>
    <p>This is a demonstration of a password scoring system written in Javascript
       and developed in parallel to be compatible with PHP.</p>
    <p><input type="password" onkeyup="password_score_field(this);" /></p>
    <div id="pwmeter"></div>
    <pre id="passdebug">
    </pre>
  </body>
</html>

PHP

echo ('Length of Diffie-Hellman prime in bits: ' .
     (strlen($_math->str($_math->init($dh_prime), 16))*4)) . '<br />';
if ( isset($_POST['do_calc']) )
{
  // our private key
  $a = $_POST['a'];
  // client's public key
  $B = $_POST['B'];
  // hash
  $s_hash = $_POST['s_hash'];
 
  $s = dh_gen_shared_secret($a, $B);
  $shex = $_math->str($s, 16);
  $s = $_math->str($s);
  echo "Shared secret: " . $s . '<br />';
  echo "Shared secret (hex): len(bits) " . (strlen($shex)*4) .
          ", key " . $shex . '<br />';
  echo "MD5: " . md5($s) . '<br />';
  echo "Expected MD5: " . htmlspecialchars($s_hash);
 
  $pass = ( md5($s) === $s_hash ) ? 'PASS' : 'FAIL';
  echo "<br />\n<br />\nTest result: <b>$pass</b>";
}

Download

Latest revision: zip | tar.gz
Mercurial clone URL: http://hg.enanocms.org/repos/geshi