Code Highlighting:
Perl
<PERL>
#!/usr/bin/perl
use strict;
use warnings;
use IO::Handle;
#Perl comment
my ( $remaining, $total );
$remaining = $total = shift(@ARGV);
STDOUT->autoflush(1);
while ( $remaining ) {
printf ( "Remaining %s/%s \r", $remaining--, $total );
sleep 1;
}
print "\n";
</PERL>
Which will be highlighted as:
#!/usr/bin/perl
use strict;
use warnings;
use IO::Handle;
#Perl comment
my ( $remaining, $total );
$remaining = $total = shift(@ARGV);
STDOUT->autoflush(1);
while ( $remaining ) {
printf ( "Remaining %s/%s \r", $remaining--, $total );
sleep 1;
}
print "\n";
C++
<CPP>
#include<iostream>
#include<vector>
int main()
/* Multiple
line comment
*/
try {
std::vector<int> vec{3,4,3,1};
int i{vec.at(4)};
}
//An exception handler, catches std::out_of_range
catch(std::out_of_range& e) {
std::cerr<<"Accessing a non-existent element:"<<e.what()<<'\n';
}
catch(std::exception& e) {
std::cerr<<"Exception thrown: "<<e.what()<<'\n';
}
</CPP>
And the highlighted version is:
#include<iostream>
#include<vector>
int main()
/* Multiple
line comment
*/
try {
std::vector<int> vec{3,4,3,1};
int i{vec.at(4)};
}
//An exception handler, catches std::out_of_range
catch(std::out_of_range& e) {
std::cerr<<"Accessing a non-existent element: "<<e.what()<<'\n';
}
catch(std::exception& e) {
std::cerr<<"Exception thrown: "<<e.what()<<'\n';
}
PYTHON
<PYTHON>
from pylab import *
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
savefig("test.png")
show()
</PYTHON>
which is highlighted here:
from pylab import *
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
savefig("test.png")
show()
Supported Languages
The supported languages are most of the code2html languages' support:
- C
- CPP
- PERL
- HTL (for html)
- AWK
- JAVA
- PYTHON
- SH
- SQL
- ADA
- JAVASCRIPT
- JS
- MAKE
- PASCAL
- RUBY
- LISP
Page Header