srchub-old

Syntaxhighlight


Table of Contents

How to use syntax highlighting

Introduction

srchub has 2 systems for syntaxhighlighting.

  • Syntaxhighlighter - http://alexgorbatchev.com/SyntaxHighlighter/
  • Prettyprint - https://code.google.com/p/google-code-prettify/

Syntaxhighliter

This is used when viewing source. You can use it in documentation/wiki as well.

If you would like to have links to lines in your sample code you can wrap your code in a <div id="highlight"> tag

For example:



/* some css */

Note: for C/C++ examples if you are including a header file then you need to use the script tag rather than a pre tag.

Example:


Pros: Looks nicer, ability to select different themes from your project management page

Cons: Have to specify the language

List of brushes

Brush Name Brush Alias
ActionScript as3, actionscript3
Bash/shell bash, shell
ColdFusion cf, coldfusion
C# c-sharp,csharp
C++ cpp, c
CSS css
Delphi delphi, pas, pascal
Diff diff, patch
Erlang erl, erlang
Groovy groovy
Javascript js, jscript, javascript
Java java
JavaFX jfx, javafx
Perl perl, pl
PHP php
Plain Text plain, text
PowerShell ps, powershell
Python py, python
Ruby rails, ror, ruby
Scala scala
SQL sql
Visual Basic vb, vbnet
XML xml, xhtml, xslt, html

Pretty print

Pretty print is a generic highlighter.

<pre class="prettyprint">
// some code
</pre>
// some code

Pros: It's simple

Cons: The highlighting isn't as good as syntaxhighlighter

Created: 10 years 7 months ago
by Natalie Adams

Updated: 9 years 10 months ago
by Natalie Adams

Labels:
Other:Featured

Old Revisions

Page rendered in 0.03611s using 26 queries.