Need AI Training/Help?CloudYeti.io/meet
MarkdownMe
Markdown editor guide

Markdown Code Blocks and Syntax Highlighting

Add fenced code blocks with a language for syntax highlighting, plus inline code, in Markdown.

Direct answer

Wrap a block of code in triple backticks and put the language right after the opening fence, like ```js, to turn on syntax highlighting. Use single backticks for inline code inside a sentence. Preview it live so you can confirm the language tag highlights the code the way you expect.

Open the Markdown Editor

When to use this

  • You are adding code to a README, issue, or docs page.
  • You want colored syntax highlighting instead of a plain gray block.
  • You need to show a command or a filename inline in a sentence.

Steps

  1. Open a code block with three backticks on their own line.
  2. Write the language name immediately after the opening backticks, such as js, python, or bash.
  3. Paste the code, then close the block with three backticks on a new line.
  4. For a short snippet inside a sentence, wrap it in single backticks instead.
  5. Preview to confirm the language highlights the code correctly.

Example

Markdown you type
Run `npm run build` before you deploy.

```python
def greet(name):
    return f"Hello, {name}!"
```

```bash
git commit -m "feat: add editor guides"
```
How it renders
Run npm run build before you deploy.  (npm run build shown in a monospace pill)

  def greet(name):                     (Python, keywords colored)
      return f"Hello, {name}!"

  git commit -m "feat: add editor guides"   (Bash, colored)

Common mistakes

  • The language tag goes on the same line as the opening backticks, with no space: ```js not ``` js.
  • Use triple backticks, not indentation, so the language highlighting turns on.
  • To show literal backticks as inline code, wrap them in a longer run of backticks, such as double backticks.

FAQ

How do I turn on syntax highlighting in Markdown?
Add the language name right after the opening triple backticks, for example ```python or ```js. Renderers like GitHub use that tag to color the code.
What is the difference between inline code and a code block?
Inline code uses single backticks around a short snippet inside a sentence. A code block uses triple backticks on their own lines and can hold many lines with highlighting.
Which languages are supported for highlighting?
Common tags include js, ts, python, bash, json, yaml, html, css, sql, and many more. If a language is unknown, the block still renders as plain monospaced code.

Related Markdown editor guides