Markdown Basics

Markdown Code Blocks: Non-Coder Guide

How to format code, commands, file paths, and config snippets in Markdown — inline code, fenced blocks, language hints, and syntax highlighting.

8 min readMarkdown Basics

Frequently asked questions

I am not a programmer. Why do I need code blocks?+

To quote a command your IT team emailed you, paste a Wi-Fi password, share a file path, or include JSON from an API response. Code blocks are for any chunk of text that needs to be copied verbatim — they preserve spacing, prevent auto-correct, and signal "this is literal, do not reformat".

Where do language hints like python or bash come from?+

They are identifiers the syntax highlighter uses to pick a color scheme. The common ones: bash, python, javascript, sql, json, yaml, html, css, ruby, go, rust. For config and plain text, you can use text, plain, or nothing at all.

Do language hints affect how AI tools understand the code?+

Yes. A fenced block tagged ```python tells the model this is Python — it interprets the content differently than it would prose. Even for plain config files, tagging the language helps the model recognize the format.

How do I show backticks inside code?+

For inline, wrap the content in two backticks instead of one: ``use `backticks` like this``. For code blocks, open and close with four backticks instead of three, or use a tilde fence (~~~) instead.

Why does indenting four spaces also make a code block?+

That is the original pre-Markdown-2 syntax. It still works in every renderer but almost nobody uses it today. Fenced code blocks with triple backticks are clearer, support language hints, and do not accidentally trigger when you indent a paragraph.

Keep learning

Put this into practice

Create a free Markdown Converters account to try everything you just read on your own documents.