---
title: "Showing code"
description: "Learn how to show code in your blog posts"
pubDate: "Dec 10 2024"
published: true
tags: ["code", "markdown"]
---

## Inline code

````mdx
Write inline code like this: `inline code`
````

### Example

this is some `inline code`

## Multiline code

Use three backticks to start and end a code block, 
optionally specify the language after the first set of backticks for syntax highlighting.

````mdx
```js
const a = 1;
const b = "this is a string";

console.log(b);
```
````

### Example

```js
const a = 1;
const b = "this is a string";

console.log(b);
```

## Code highlighting

Add `// [!code highlight]` at the end of a line to highlight it

### Example

```js
const hello = "Hello world!";
console.log(hello); // [!code highlight]
```
