# Selecting the programming language used in code blocks

**URL:** https://meta.discourse.org/t/selecting-the-programming-language-used-in-code-blocks/19247
**Category:** Using Discourse
**Tags:** how-to
**Created:** [August 25, 2014, 8:40am UTC](https://meta.discourse.org/t/selecting-the-programming-language-used-in-code-blocks/19247 "2014-08-25T08:40:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [August 25, 2014, 6:25am UTC](https://meta.discourse.org/t/selecting-the-programming-language-used-in-code-blocks/19247/1 "2014-08-25T06:25:53Z")

</div>

> 🔖 This guide explains how to select the programming language used in code blocks within Discourse posts, along with how to suppress syntax highlighting.
> 
> 🙋 Required user level: All users

When you enclose code using triple backticks in your posts, Discourse uses [highlight.js](https://highlightjs.org/) to automatically detect and apply syntax highlighting to the code. However, you can specify the programming language if the autodetection does not work as expected.

## Specifying the programming language for code blocks

To specify the programming language for a code block, type the name of the language right after the first set of backticks:

````
``` your_language
# Your code here
```

````

For example, to specify Ruby:

````
``` ruby
3.times do |stuff|
  stuff.do
end
```

````

The result will look like this:

```ruby
3.times do |stuff|
  stuff.do
end

```

The language must be one of the `highlighted languages` configured for syntax highlighting on your site. If a language is not working, consult your site administrator.

## Suppressing highlighting

If you want to prevent any syntax highlighting, you can use `text`, `plain`, or `pre` as the language:

````
``` text
Your text to NOT highlight here
```

````

The result will appear as plain text without any highlighting:

```plaintext
Your text to NOT highlight here

```

## Best practices

- Always specify the language if the automatic detection is not recognizing your code correctly.
- **For admins** : Ensure to verify that the chosen language is configured in the `highlighted languages` site setting.

## Additional resources

- [Configure which programming languages are available for syntax highlighting](https://meta.discourse.org/t/configure-which-programming-languages-are-available-for-syntax-highlighting/239717)

> Last edited by @hugh 2024-06-25T05:53:26Z
> 
> > **Check document**
> >
> > Perform check on document:
