Code Syntax Highlighting

You can tell the system which language you're writing code in, and it will automatically format and color code it according to widely recognized standards. Here is the list of languages that are supported - just look for where it says "Name:" and use that string inside the % CODE {" "} % block. If the language you're writing is not supported, pick another one and see if you like the color coding; otherwise, try another one.

For example,
<sticky>
%CODE{"c++"}%
#include <iostream>
int main()
{
  std::cout << "Hello, world." << std::endl;
}
%ENDCODE%</sticky>

renders this:

#include <iostream>
int main()
{
  std::cout << "Hello, world." << std::endl;
}

By using the num argument, you can insert line numbers starting at that number. So this:

<sticky>
%CODE{"sh" num="10"}% 
#!/bin/sh
languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
for l in $languages; do
    cat << EOF
   * $l
EOF
done
%ENDCODE% </sticky>

renders this:

   10	#!/bin/sh
   11	languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
   12	for l in $languages; do
   13	    cat << EOF
   14	   * $l
   15	EOF
   16	done


-- NicoleRadziwill - 06 Mar 2020
Topic revision: r3 - 13 Apr 2020, NicoleRadziwill
© 2020 Ultranauts - 75 Broad Street, 2nd Floor, Suite 206, New York, NY 10004 - info@ultranauts.co