# Forum: specify code language

**URL:** <https://discourse.processing.org/t/forum-specify-code-language/227>\
**Category:** Site Feedback\
**Created:** [May 21, 2018, 10:12pm UTC](https://discourse.processing.org/t/forum-specify-code-language/227 "2018-05-21T22:12:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2018, 10:12pm UTC](https://discourse.processing.org/t/forum-specify-code-language/227/1 "2018-05-21T22:12:03Z")

</div>

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](https://highlightjs.org/), 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)

```auto
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Prints the string to the console.
    }
}

```

Java (labeled): `java`

```java
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Prints the string to the console.
    }
}

```

JavaScript (auto)

```auto
console.log("Hello World!");

```

JavaScript (labeled): `javascript`

```javascript
console.log("Hello World!");

```

Python (auto)

```auto
print("Hello World")

```

Python (labeled): `python`

```python
print("Hello World")

```

Ruby (auto)

```auto
puts 'Hello World!'

```

Ruby (labeled): `ruby`

```ruby
puts 'Hello World!'

```

It looks like adding additional highlightjs language to discourse may be an admin feature:

> **[Adding additional languages to highlight.js used by Discourse](https://meta.discourse.org/t/adding-additional-languages-to-highlight-js-used-by-discourse/22925/5)**
>
> This is now supported, for example, I enabled scss here on meta, cause we use it: @import "compass/reset"; // variables $colorGreen: #008000; $colorGreenDark: darken($colorGreen, 10); To select the languages you want the highlighted languages...

---

<div class="post-metadata">

**Author:** ![colouredmirrorball](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/colouredmirrorball/32/234_2.png) [@colouredmirrorball](https://discourse.processing.org/u/colouredmirrorball)\
**Post date:** [May 21, 2018, 10:20pm UTC](https://discourse.processing.org/t/forum-specify-code-language/227/2 "2018-05-21T22:20:50Z")

</div>

Is there a way to include custom code highlighting rules, especially for Processing code?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2018, 10:27pm UTC](https://discourse.processing.org/t/forum-specify-code-language/227/3 "2018-05-21T22:27:23Z")

</div>

Yes, it looks like there are docs on writing highlightjs languages, however there are currently 176 listed on [theit homepage](https://highlightjs.org/download/) and [Processing is one of the languages listed](https://highlightjs.org/download/). You can also set a Discourse site to have a default code language.

I haven’t been involved in the Processing website, but I think the fact that this exists has been on their radar for a long time:

> <https://github.com/processing/processing-web-archive/issues/199>

  

> <https://github.com/processing/processing-web-archive/issues/31>

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [May 27, 2018, 4:03am UTC](https://discourse.processing.org/t/forum-specify-code-language/227/4 "2018-05-27T04:03:29Z")

</div>

@jeremydouglass Could you rename your post as how to “Format your code”? We could use it to show ppl how to format code in the forum.

Kf

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 27, 2018, 7:19am UTC](https://discourse.processing.org/t/forum-specify-code-language/227/5 "2018-05-27T07:19:08Z")

</div>

Good idea to add FAQ information for formatting like on the old forum (but different) – although I think particular post is too technical to also serve that purpose.
