Hey,
the forums now support code highlighting. If you use normal “<” code tags the highlighting will be for java by default. You can use other languages by using square brackets and the language name as tag name, like [myLanguage]code here[/myLanguage]. Supported tags for example are “c”, “cpp”, “xml”, “scala”, “groovy” and even “patch”. Look here for a complete lst.
Example:
public class MyClass{
public void myMethod(String param){
doStuff();
}
}
Cheers,
Normen
Nice, thanks (old one wasn’t really readable…)!
Excellent!! Next task is to bug the snippet developer to make them work inline in posts
@sbook Yeah, its really handy, already re-used a script in a post
These are the parameters you can pass to the shortcode and what they do. For the booleans (i.e. on/off), pass true/1 or false/0 e.g. [lang light=“true”]
autolinks — Toggle automatic URL linking.
collapse — Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.
firstline — An interger specifying what number the first line should be (for the line numbering).
gutter — Toggle the left-side line numbering.
highlight — A comma-sperated list of line numbers to highlight.
htmlscript — Toggle highlighting any extra HTML/XML. Good for when you’re mixing HTML/XML with another language, such as having PHP inside an HTML web page. The above preview has it enabled for example. This only works with certain languages.
light — Toggle light mode which disables the gutter and toolbar all at once.
padlinenumbers — Controls line number padding. Valid values are false (no padding), true (automatic padding), or an integer (forced padding).
toolbar — Toggle the toolbar containing the helpful buttons.
wraplines — Toggle line wrapping.
wow, I hadn’t realized it had so many features… good stuff!
Ok, I disabled the “toolbar” (because it was slowing down the page severely in most browsers) and then I had to disable the line numbering because w/o the toolbar you cannot copy the text to clipboard without the line numbers When the plugin updates to the most current version of the highlighter javascript I can enable both again as it should be loads faster then.
For now you can use the parameters above to enable the features if you want.
Cheers,
Normen
Yes, because you cannot copy&paste the code without the line numbers (see previous post)