IkiWiki::Plugin::syntax - Add syntax highlighting to ikiwiki
In any source page include the following:
This is the example code [[syntax language=perl text=""" #!/usr/bin/perl print "Hello, world\n"; """]] and this is my bash profile (using file type autodetection ) [[syntax file="software/examples/mybash_profile" description="My profile" ]]
In order to facilitate the life to the administrator the plugin could create a html table with information about the engine capabilities.
Use the directive syntax without any parameters as is:
syntax
This is the syntax engine chart in this site: [[syntax ]]
This plugin adds syntax highlight capabilities to Ikiwiki using third party modules if they are installed.
Those modules can be:
Syntax::Highlight::Engine::Kate
Uses the Syntax::Highlight::Engine::Kate package, a port to Perl of the syntax highlight engine of the Kate text editor.
Copyright (c) 2006 by Hans Jeuken, all rights reserved.
Text::VimColor
This plugin uses the Text::VimColor module and the vim editor.
Copyright 2002-2006, Geoff Richards.
IkiWiki::Plugin::syntax::Simple
This is the default engine. It's a passtrough engine with line numering capability.
and they can be selected at runtime with the syntax_engine parameter. In case of fail loading the module the plugin switch to use the simple engine.
syntax_engine
The module register a preprocessor directive named syntax.
The syntax directive has the following parameters:
Name of the source language for select the correct plugin. If not defined the module will try to determine the appropiated value.
Text description for the html link
Source text for syntax highlighting. Mandatory if not exists the file parameter.
Ikiwiki page name as source text for syntax highlighting. The final html includes a link to it for direct download.
Enable the line numbers in the final html.
Enable the bars feature. The final html text will be label with css tags on the odd lines.
Parameter for inline funcion to the source page
This method is called by IkiWiki main program and the plugin uses it for load global configuration values and initialize his internals.
This method is called when the ikiwiki parser found a syntax directive. Without parameters the method show information about the external syntax parser.
IkiWiki::Plugin::syntax uses the following global parameters:
Set to a keyword for select the engine to use.
Uses the Syntax::Highlight::Engine::Kate as backend.
Uses the Text::VimColor as backend.
Uses the IkiWiki::Plugin::syntax::Simple as backend.
If this parameter is omitted or the external module fails, the plugin switch to use the Simple engine.
Parameters to configure the engine (not implemented yet).
The module needs the following perl packages:
Extension to Module::Build for build and install ikiwiki plugins.
And it recommends:
Please report any bugs or feature requests to the author.
"Víctor Moral" victor@taquiones.net
victor@taquiones.net
Copyright (c) 2008, "Víctor Moral".
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '"Víctor'. Assuming UTF-8
To install IkiWiki::Plugin::syntax, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IkiWiki::Plugin::syntax
CPAN shell
perl -MCPAN -e shell install IkiWiki::Plugin::syntax
For more information on module installation, please visit the detailed CPAN module installation guide.