#3: Use a monospace font for code snippets

👍0
👎0

Add your vote!

Back to all styles

In markdown, you can use single backticks (`) for inline code `like this`.

This applies to things like:

  • blocks of code
  • stack traces
  • names of libraries
  • example variable names
  • version ranges
  • ...anything that may appear in a line of code!

Markdown

For whole blocks of code, you can use triple backticks (```):

```
like this!
```

For inline code snippets, you can use single backticks (`like this`):

Google Docs

In Google Docs, you'll have to manually apply a monospace font, such as Consolas.

JIRA

  • Use {code} for code blocks
  • Use {{foo}} for inline text

Why?

Developers are used to reading code in a monospace font - this is the standard in IDEs and terminals. Reading code in a non-monospace font is often harder to parse, and look jarring.