srchub-old

Syntaxhighlight


You are looking at an old revision of the page Syntaxhighlight. This revision was created by Natalie Adams.

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

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 9 months ago
by Natalie Adams

Updated: 10 years 6 days ago
by Natalie Adams

Labels:
Other:Featured

Old Revisions

Page rendered in 0.02434s using 26 queries.