hints & tips // 2007.08.30 08:50:57 [hh]
Formatierte Quelltexte in Web-Seiten: der "SyntaxHighlighter" hilft
Falls Sie hin und wieder Code-Fragmente online publizieren müssen und auf der Suche nach einem geeigneten Tool zur Präsentation waren, dann suchen Sie nicht weiter. Screen2.0 hat die Lösung gefunden: ein Google-Code-JavaScript namens "SyntaxHighlighter". Urheber Alex Gorbatchev zu seinem 11KB großen Tool: "The idea behind SyntaxHighlighter is to allow insertion of colored code snippets on a web page without relying on any server side scripts."
Das Tool bietet laut dem Urheber Alex Gorbatchev folgende Features:
- "100% client side, no server dependency
- Multiple languages support
- Easy to use and deploy, just copy files and link them in your templates
- Wide browser support
- Very lightweight, compressed core library is 11kb plus whatever brushes you need.
SyntaxHighlighter uses regular expressions to parse the text. It's not extremely fast, in fact, it's pretty slow. If you are trying to highlight a few dozens lines of code, you won't see any problems. Trying to highlight 10kb worth of text will result in JavaScript being aborted because of long execution time."
Zu den unterstützten Sprachen für die syntaktische Hervorhebung zählen C++, C#, CSS, Delphi, Java, JavaScript, PHP, Python, Ruby, SQL, VisualBasic, sowie XML und HTML.
Weitere Informationen: code.google.com/ p/ syntaxhighlighter
Werbung