Difference between revisions of "Syntax Highlighting"
(info on highlighting source code) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Syntax Highlighting in Quanta == | == Syntax Highlighting in Quanta == | ||
Quanta has syntax defintion files which are called 'DTEP' files. | Quanta has syntax defintion files which are called 'DTEP' files. | ||
Line 39: | Line 28: | ||
== Syntax Highlighting in MediaWiki == | == Syntax Highlighting in MediaWiki == | ||
− | + | Writing good code, especially in open source context, requires illustrating best practices and tutorials. Those tutorials are made ever more useful with syntax-highlighting. | |
− | Writing good code, especially in open source context, requires illustrating best practices and tutorials. Those tutorials are made ever more useful with syntax highlighting. | ||
MediaWiki is able to incorporate a nice 3rd-party project called [http://qbnz.com/highlighter/faq.php Generic Syntax Highlighter] or GeSHi for short. Fortunately GeSHi is now packaged with debian for easy installation on Debian or Debian-based systems. There is a [[mw:Extension:SyntaxHighlight_GeSHi]] extension which provides a tie-in between MediaWiki and GeSHi. (note that there are a few different GeSHi extensions for mediawiki, and we use the one in use on mediawiki.org http://www.mediawiki.org/wiki/Special:Version). | MediaWiki is able to incorporate a nice 3rd-party project called [http://qbnz.com/highlighter/faq.php Generic Syntax Highlighter] or GeSHi for short. Fortunately GeSHi is now packaged with debian for easy installation on Debian or Debian-based systems. There is a [[mw:Extension:SyntaxHighlight_GeSHi]] extension which provides a tie-in between MediaWiki and GeSHi. (note that there are a few different GeSHi extensions for mediawiki, and we use the one in use on mediawiki.org http://www.mediawiki.org/wiki/Special:Version). | ||
Line 55: | Line 43: | ||
=== Usage === | === Usage === | ||
See the [[mw:Extension:SyntaxHighlight_GeSHi#Examples]] | See the [[mw:Extension:SyntaxHighlight_GeSHi#Examples]] | ||
− | |||
<nowiki> | <nowiki> |
Revision as of 22:06, 1 December 2008
Contents
Syntax Highlighting in Quanta[edit | edit source]
Quanta has syntax defintion files which are called 'DTEP' files. See the quanta dev list, website, or help:/quanta (Quanta Manual in konqueror). These files are stored in
# application directory
/usr/share/apps/quanta/dtep/
# local user directory
~/.kde/share/apps/quanta/dtep/
placing a new directory, which includes all tag definitions, in one of those locations will provide all the info Quanta needs to understand the syntax. On the Quanta site there is a DTEP for TaskJuggler syntax.
Syntax Highlighing in VIM[edit | edit source]
To add syntax highlighting for a particular language or syntax, you need to have a syntax definition file, and then you need to 'turn it on' by setting it up in your local configuration file. For example, there is a syntax file for TaskJuggler, which can be turned on thusly:
sudo cp /usr/local/src/taskjuggler-2.2.0/Contrib/vim/tjp.vim /usr/share/vim/vimcurrent/syntax/
sudo chmod o+r /usr/share/vim/vimcurrent/syntax/tjp.vim
echo 'if has("autocmd")
augroup taskjuggler
au! BufNewFile,BufRead *.tj{p,i} set ft=tjp
augroup END
endif' >> ~/.vimrc
Syntax Highlighting in Konsole[edit | edit source]
Syntax Highlighting in Websvn[edit | edit source]
The current syntax highlighting in websvn is handled via GNU enscript
Syntax Highlighting in MediaWiki[edit | edit source]
Writing good code, especially in open source context, requires illustrating best practices and tutorials. Those tutorials are made ever more useful with syntax-highlighting.
MediaWiki is able to incorporate a nice 3rd-party project called Generic Syntax Highlighter or GeSHi for short. Fortunately GeSHi is now packaged with debian for easy installation on Debian or Debian-based systems. There is a mw:Extension:SyntaxHighlight_GeSHi extension which provides a tie-in between MediaWiki and GeSHi. (note that there are a few different GeSHi extensions for mediawiki, and we use the one in use on mediawiki.org http://www.mediawiki.org/wiki/Special:Version).
To install the actual GeSHi software package (it installs in /usr/share)
sudo apt-get install php-geshi
ls /usr/share/php-geshi/
contrib geshi geshi.php
Incorporating GeSHi into Mediawiki is just a matter of adding the extension to the source tree and including it in LocalSettings.
Usage[edit | edit source]
See the mw:Extension:SyntaxHighlight_GeSHi#Examples
<source lang="php"> $v = array_pop($foo); // just a comment </source>
Supported Languages[edit | edit source]
mw:Extension:SyntaxHighlight_GeSHi#Supported_languages
Documentation[edit | edit source]
See http://qbnz.com/highlighter/geshi-doc.html for the extensive documentation. GeSHi is used in a number of other software projects like
- Dokuwiki - An advanced wiki engine
- gtk.php.net - Their manual uses GeSHi for syntax highlighting
- WordPress - A powerful blogging system*
- PHP-Fusion - A constantly evovling CMS
- SQL Manager - A Postgres DBAL
- Mambo - A popular open source CMS
- MediaWiki - A leader in Wikis*
- TikiWiki - A megapowerful Wiki/CMS
- TikiPro - Another powerful Wiki based on Tikiwiki
- RWeb - A site-building tool