LearnCpp.com now supports Markdown for comment formatting!
Markdown is a simple-to-use syntax used to apply formatting to text that is typed in a text editor or textbox. It is similar to HTML, but is designed to be easier to type and more human-readable.
For example:
Syntax | To bold text, you’d type: |
---|---|
HTML | This text should be <strong>bold</strong> |
Markdown | This text should be **bold** |
Markdown has been widely adopted across the internet (on sites such as Stack Overflow and Github).
Supported Markdown on LearnCpp
Formatting | If you type this in the comment form | It will display like this when the comment is submitted |
Notes |
---|---|---|---|
Bold | This is **bold** text | This is bold text | |
Underline | This is ___underlined___ text | This is underlined text | Opening/closing ___ must be preceded/followed by whitespace |
URL | [LearnCpp](https://www.learncpp.com/) | LearnCpp | |
Inline code | Don’t forget to `#include <iostream>` | Don’t forget to #include <iostream> |
Can be used in the middle of a sentence Uses backticks (`), not single quotes (‘) |
Code block | ``` #include <iostream> int main() { return 0; } ``` |
|
Opening and closing ``` must be on separate line Uses backticks (```), not single quotes (”’) Can also use tildes (~~~) |
If you’re already familiar with Markdown syntax already, you can type Markdown formatting directly into the comment form.
Using the Quicktag buttons
If you’re not familiar with Markdown syntax, you can use the Quicktag buttons above the comment form. These buttons will insert the appropriate Markdown formatting for you.
If you’re not sure what a Quicktag button does, hover over it to see the tooltip that describes its function.
What’s the difference between inline code and a code block?
Inline code is designed to display a snippet of code as part of an existing sentence. It is normally used to highlight a variable or function name, or display a single line of code.
A code block is designed to display an entire program. It uses the syntax highlighter to make the code easier to read.
Q: Hello, is it me you’re looking for?
If this didn’t answer your question, or if something above wasn’t clear, please leave a comment below and we’ll fix it.