2014-09-07 01:26:12 +02:00
|
|
|
title: Syntax Highlighting
|
|
|
|
|
2012-04-08 11:23:49 +02:00
|
|
|
# Syntax Highlighting
|
|
|
|
|
|
|
|
The custom Markdown parser can render custom prefixes for code blocks, and
|
|
|
|
render it via a [javascript syntax highlighter](http://alexgorbatchev.com/SyntaxHighlighter).
|
|
|
|
|
2013-02-19 10:23:22 +01:00
|
|
|
To see examples of the syntax, check out the source of this file in docs/en/
|
2012-04-08 11:23:49 +02:00
|
|
|
|
|
|
|
To include the syntax highlighter source, add the following to your `DocumentationViewer->init()`:
|
|
|
|
|
2013-02-19 10:23:22 +01:00
|
|
|
|
|
|
|
```php
|
|
|
|
Requirements::javascript(THIRDPARTY_DIR .'/jquery/jquery.js');
|
|
|
|
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shCore.js');
|
|
|
|
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushJScript.js');
|
|
|
|
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushPHP.js');
|
|
|
|
Requirements::javascript('sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushXML.js');
|
2014-09-07 01:26:12 +02:00
|
|
|
|
2013-02-19 10:23:22 +01:00
|
|
|
// ... any additional syntaxes you want to support
|
|
|
|
Requirements::combine_files(
|
|
|
|
'syntaxhighlighter.js',
|
|
|
|
array(
|
|
|
|
'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shCore.js',
|
|
|
|
'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushJScript.js',
|
|
|
|
'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushPHP.js',
|
|
|
|
'sapphiredocs/thirdparty/syntaxhighlighter/scripts/shBrushXML.js'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
Requirements::javascript('sapphiredocs/javascript/DocumentationViewer.js');
|
|
|
|
|
|
|
|
// css
|
|
|
|
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shCore.css');
|
|
|
|
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shCoreDefault.css');
|
|
|
|
Requirements::css('sapphiredocs/thirdparty/syntaxhighlighter/styles/shThemeRDark.css');
|
|
|
|
```
|