Code Blocks & Quotes in Markdown

Interactive Markdown tutorial: inline code, fenced code blocks with language labels, blockquotes and horizontal rules. Edit a live example and see the result instantly.

When you write about code — or quote a source — Markdown has dedicated formatting that keeps everything readable and correctly spaced.

Inline code

Wrap short snippets in single backticks so they render in a monospace font: `mean(x)` becomes mean(x). Use it for function names, variables and file paths inside a sentence.

Fenced code blocks

For multi-line code, put three backticks on their own line above and below the block. Add a language name after the opening backticks (like r, python or bash) so it can be syntax-highlighted:

```r
x <- c(1, 2, 3)
mean(x)
```

The block preserves every space and line break exactly as you typed it — nothing inside is treated as Markdown.

Blockquotes and rules

Start a line with > to create a blockquote, and put three dashes --- on their own line for a horizontal rule (a divider). Try it all below:

The fenced block keeps the R code monospaced and untouched, the > line becomes an indented quote, and --- draws a divider. This is exactly how code appears in a Quarto document — except there, an {r} block also runs and shows its output.


Next: Tables → — laying out data in rows and columns.