SyntaxHighlightBundle
The package encapsulates into Symfony/composer bundle following Syntax Highlighter, (*1)
SyntaxHighlighter
version 3.0.83 (July 02 2010)
http://alexgorbatchev.com/SyntaxHighlighter
JavaScript code syntax highlighter.
Copyright 2004-2010 Alex Gorbatchev.
INSTALLATION:
First add the dependency to your composer.json
file:, (*2)
"require": {
...
"alten/syntax-highlight-bundle": "dev-master"
},
Then install the bundle with the command:, (*3)
php composer.phar update
Enable the bundle in your application kernel:, (*4)
``` php
<?php
// app/AppKernel.php, (*5)
public function registerBundles()
{
$bundles = array(
// ...
new Alten\SyntaxHighlightBundle\AltenSyntaxHighlightBundle(),
);
}, (*6)
Now install assets:
php bin/console assets:install [--symlink]
### **USAGE**
Add the following lines to your base twig file:
``` html
<link type="text/css" rel="stylesheet" href="{{ asset('bundles/altensyntaxhighlight/css/styles/shCoreMidnight.css') }}"/>
<link type="text/css" rel="stylesheet" href="{{ asset('bundles/altensyntaxhighlight/css/styles/shThemeMidnight.css') }}"/>
And in a WYSYWIG editor you may switch to raw mode and use a <pre class="brush: cpp"> tag:
``` html, (*7)
#include
int main() {
std::cout
```, (*8)