Formatting
By the end of this lesson you'll be able to make text bold , italic , and struck through , drop in inline code and syntax-highlighted code blocks, and shape a document with blockquotes and dividers — the everyday toolkit behind every README, GitHub comment, and docs page.
Part of the free Markdown course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
What You'll Learn
💡 Real-World Analogy
Think of Markdown markers like a highlighter set . You don't open a menu to change a font — you wrap the words you care about in a symbol, the way you'd run a highlighter over a sentence. One asterisk on each side is a thin highlight (italic); two is a bold one; two tildes draw a line through it. The key habit: a marker has to hug both ends of the text, like opening and closing a bracket. Forget the closing marker and the renderer just shows the symbol as plain text.
1. Bold, Italic & Bold+Italic
Wrap text in one asterisk or underscore for italic , two for bold , and three for both at once. The marker must touch the text on both sides — **bold** , never ** bold ** .
Source → Rendered
Prefer asterisks ( * ) over underscores ( _ ). Underscores inside words — like my_file_name — can accidentally trigger italics in some renderers. Asterisks never do.
2. Strikethrough & Inline Code
Two tildes on each side ( ~~like this~~ ) draw a line through text — handy for "old price, new price". A single backtick on each side makes inline code : a monospace snippet that won't be treated as Markdown, so symbols inside it stay literal.
Inside code, stars stay literal: a ** b means a to the power b.
Need a literal backtick inside inline code? Wrap with double backticks: use here .
3. Fenced Code Blocks (with highlighting)
For more than a word or two of code, use a fence : three backticks on a line of their own, then your code, then three backticks to close. Write the language name right after the opening fence — RENDERED RESULT
Common language tags: js , python , html , css , bash , json , sql , ts . GitHub, GitLab, and most docs tools recognise dozens more.
4. Blockquotes (and nesting)
Start a line with > to make a blockquote — usually rendered as an indented bar, great for callouts, quotes, or "Note:" boxes. Add a second >> to nest a quote inside a quote. Keep the > on every line you want included.
5. Horizontal Rules & Line Breaks
Three or more --- (or *** or ___ ) on a line by themselves draw a horizontal rule — a full-width divider. Line breaks are sneakier: a single newline is usually ignored . To force a hard break within a paragraph, end the line with two spaces or a backslash ( \ ); leave a fully blank line to start a new paragraph.
The ·· above marks two invisible trailing spaces. Because trailing spaces are easy to miss in review, many people prefer the visible backslash for hard breaks.
Common Errors (and the fix)
- Spaces inside the markers: ** bold ** renders as literal asterisks, not bold. The marker must hug the text — write **bold** with no inner spaces.
- Forgetting the language on a code fence: js .
- Unmatched * markers: emphasis needs a matched pair. *italic with no closing * shows a stray asterisk — every opening marker needs a closing one.
- Unclosed code fence: forgetting the final code js … python . Also check the fence is exactly three backticks on its own line, not indented. Q: Is strikethrough standard Markdown? ~~text~~ isn't in the original spec, but it's part of GitHub Flavored Markdown (GFM) , which GitHub, GitLab, Reddit, and most modern tools use — so in practice it works almost everywhere. Q: Why did my two lines merge into one? A single newline doesn't break a line in Markdown. End the first line with two spaces or a backslash for a hard break, or leave a blank line between them to make separate paragraphs. Mini-Challenge: Release Note No blanks this time — just a brief and a blank canvas (with an outline to keep you on track). Write the Markdown yourself, run it, then paste the output into a previewer and check it against the expected result in the comments. 🎉 Lesson Complete ✅ *italic* , **bold** , ***both*** — markers must hug the text, no inner spaces
- ✅ ~~strikethrough~~ and for snippets that stay literal
- ✅ Fenced code blocks with a language tag ( `js ) get syntax highlighting
- ✅ > makes a blockquote; >> nests one inside another
- ✅ --- draws a horizontal rule; two trailing spaces or \ force a hard line break
- ✅ Next lesson: Lists & Tables — organise information into ordered, unordered, and tabular layouts
Continue this course
- Previous: Introduction to Markdown
- Next: Lists and Tables