Skip to the content.

Best Practices for Bullet Points and Code Blocks in Markdown

Practice Bullet Points Code Blocks
Blank Line Before Starting Always leave a blank line before bullet points to avoid misinterpretation as a code block. Leave a blank line before a code block to separate it from the previous text.
Consistent Indentation Use consistent indentation for nested bullet points (e.g., two spaces or tabs). Use at least four spaces or triple backticks (```) for multi-line code blocks.
Proper Symbol for Bullets Use -, *, or + for bullet points, but don’t mix them within the same list. Use triple backticks (```) for code fences or indent the block with four spaces for inline formatting.
Avoid Indentation Before the List Ensure bullet points start at the left margin (unless nested). Indent code blocks only if inside a list or other structured content.
Escape Special Characters Escape characters like *, _, or - with a backslash (\) if needed within the text. No need to escape special characters inside code blocks; they are treated as plain text.
Inline Code within Bullet Points Use single backticks (`) for inline code: \like this``. Use single backticks for inline code snippets or special keywords.
Numbered Lists with Code Blocks For numbered lists, start each item with a number and ensure no empty line between the number and the code. Indent the code block under the numbered item with at least four spaces, or use triple backticks inside the item for clean formatting.
Avoid Over-Indentation Do not over-indent bullet points to avoid accidental interpretation as a code block. Ensure proper alignment when nesting code blocks within bullet points.

Rendering Markdown in VS Code:

Action Shortcut Description
Side-by-Side Markdown Preview Ctrl + K V Opens the editor and a rendered preview side-by-side.
Standalone Markdown Preview Ctrl + Shift + V Opens a full-page rendered Markdown preview.
Toggle Focus to Editor Ctrl + Shift + X Switches back focus to the Markdown editor.
Toggle Sidebar Ctrl + B Hides/shows the sidebar for more space.