The most common languages on the Processing forum are Java, JavaScript / HTML+CSS, and Python – although lots of other things get talked about, including Ruby, R, CoffeeScript, et cetera.
The new Discourse forum uses highlight.js, which auto-detects the language of code inside of <pre><code></code></pre>
(generated by markdown).
Languages may be specified by manually specified by writing the language keyword after the three backticks of an opening code gate, like this: ```java
These keywords are specific and case sensitive – “java” will work, “Java” will not.
Doing so generates HTML like this:
<pre><code class="lang-java">...</code></pre>
The auto-format styling and manual format styling are not the same.
Here is an example of two code blocks – one written with nothing after the opening backtick gate, the other with the keyword java
.
Java (auto)
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Prints the string to the console.
}
}
Java (labeled): java
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Prints the string to the console.
}
}
JavaScript (auto)
console.log("Hello World!");
JavaScript (labeled): javascript
console.log("Hello World!");
Python (auto)
print("Hello World")
Python (labeled): python
print("Hello World")
Ruby (auto)
puts 'Hello World!'
Ruby (labeled): ruby
puts 'Hello World!'
It looks like adding additional highlightjs language to discourse may be an admin feature: