# PSA: how to quote code with backticks

**URL:** https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530
**Category:** Meta Discussion
**Tags:** psa
**Created:** [December 5, 2017, 1:33pm UTC](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530 "2017-12-05T13:33:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 5, 2017, 1:33pm UTC](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530/1 "2017-12-05T13:33:20Z")

</div>

This is a short post on how to use backticks (``` and `````) to _quote_ code, so it is easy to read. This post can be linked to new users who are confused by this feature.

# Why

By quoting your code, you get a monospaced font (which preserves indentation) and syntax highlighting. This makes it easier to read your code and help you.

Displayed code looks like this:

```julia
function displayed_code(x::Int, y::Int)
    if x < y
        println("x is smaller")
    else
        println("or not")
    end
end

```

Inline code `looks_like_this(c::Float64)`.

# How

Discourse uses [Markdown](http://commonmark.org/). The markdown specification uses _triple backticks_ ````` to _open_ and _close_ displayed code blocks. A language can optionally be specified immediately after the opening `````. On this forum, the default language is `julia`.

````markdown
```julia
function displayed_code(x::Int, y::Int)
    if x < y
        println("x is smaller")
    else
        println("or not")
    end
end
```

````

The inline syntax uses _single backticks_: ``looks_like_this(c::Float64)`` (You can’t specify a language with inline code, so there is no syntax highlighting.)

# Where

The [backtick](https://en.wikipedia.org/wiki/Backtick) character (```) is located in the top left of the U.S. keyboard, above the Tab key.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/8/b85bf8c9a77e39e78f977edd28e4e1aeb5a2dae0.png)

It looks similar to but is different from the [apostrophe](https://en.wikipedia.org/wiki/Apostrophe) character (`'`), sometimes also called a single quote.

On mobile, you will typically need to hold down the apostrophe key until a pop-up of similar characters appear for selection. Backtick is usually the option farthest to the left.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/1/e1501d7962353dfb9188105760337a1516b9a81e.png)

# When

Always wrap code in backticks so it renders correctly and is distinguished from commentary. When writing your post, the _preview window_ on the right side will show the formatted text. Check that the preview is formatted as you intended before posting.

**That’s it! Please take advantage of this feature to make it easier to help you.**

* * *

## Advanced

### Quotes Contianing Backticks

If you want to quote backticks themselves, enclose them in _more_ backticks: ``` ` ``` renders as ```, and

`````markdown
````julia
"""
This is how you use this function:
```julia
1+1
```
"""
````

`````

produces

````julia
"""
This is how you use this function:
```julia
1+1
```
"""

````

which is useful when quoting code with docstrings that have ````` in them.

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [October 16, 2023, 6:01pm UTC](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530/2 "2023-10-16T18:01:37Z")

</div>

7 posts were split to a new topic: [Iterative feedback and discussion on the blockquote PSA](https://discourse.julialang.org/t/iterative-feedback-and-discussion-on-the-blockquote-psa/105031)

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [October 16, 2023, 6:01pm UTC](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530/3 "2023-10-16T18:01:59Z")

</div>


