How do I format code in my posts?

Codecademy Discuss posts are parsed with Markdown. Markdown allows for easy formatting of code and text, and strips HTML out of posts by default to prevent security risks. This will show you how to format your code so it shows up.

Summary

To format code so it’s visible, either wrap it in single backticks for a small amount of code, or triple backticks on an otherwise blank line before and after for a large amount of code.

Details

Inline code

To indicate a small span of code, wrap it in backticks (`). For example:

How do I use the `console.log()` function?

would produce:

How do I use the console.log() function?

Code Blocks

Toolbar Icon
Using Preformatted Text icon on the toolbar


This will automatically create a code block which you can paste your code in.
capture_r
Or select your code and then press the icon.

Manually

To indicate a code block, either wrap the entire block in three backticks:

```
<!DOCTYPE html>
<html>
  <head>
    <!-- metadata and external resources-->
  </head>
  
  <body>
    <!-- page content -->
  </body>
</html>
```

Or you can indent the code with four (4) spaces:

    <!DOCTYPE html>
    <html>
      <head>
        <!-- metadata and external resources-->
      </head>
      
      <body>
        <!-- page content -->
      </body>
    </html>

The first produces:

<!DOCTYPE html>
<html>
  <head>
    <!-- metadata and external resources-->
  </head>
  
  <body>
    <!-- page content -->
  </body>
</html>

The second produces:

<!DOCTYPE html>
<html>
  <head>
    <!-- metadata and external resources-->
  </head>
  
  <body>
    <!-- page content -->
  </body>
</html>

For more information on Markdown Formatting, visit daringfireball.net.

38 Likes
11. Adding images. What is going on?
What's the problem wit this code?
Adding image problem
I need Help
HTML Basics ll 11/16 I don't get the Error: Oops, try again. Did you remember to set the font-family to Arial?
My image tag is not showing up?
Isn't there a mistake in the Code Acadamy example in the Link 'em up page?
Number Guesser for Javascript
FAQ: Advanced Objects - Arrow Functions and this
In the example, how does fun_one know what m is?
Difference between low, high and low_limit, high_limit?
Best Fare Calculator
FAQ: Learn Java: Methods - Review
How to post a project here?
Credit card checker
Broadway exercise overlapping divs
FAQ: Learn Java: Methods - Review
FAQ: Introduction to PHP Functions - Returning NULL
Object of your affection
FAQ: Variables - User Input
Meal Maker Poject
Indention in HTML -images
Indention in HTML -images
FAQ: Code Challenge: Loops - Reversed List
FAQ: Vectors - Review
Common email, password and Login issues
FAQ: Functions - Tackling Multiple Arguments
Rock,Paper,Scissors Project
How to ask good questions (and get good answers)
"Textarea" is appearing when I try to add default text
New York City Blog Project: problem with <article>
FAQ: Code Challenge: Loops - Max Num
My Python function won't run
Why is this image taking up the fulllength of the page?
Lists and Loops return
Sal's shipping python control flow
Noob coding question
Calling the function -- https://www.codecademy.com/courses/functions_in_javascript/0/1
It can't see my <!doctype> tag
MOVE (supporting - how to get text to go inline)
Blank space in The Innovation Cloud Project
<p> tags
Show a tag 5/9
Here is my code:
Background-color
HTML Basics lll 9. Styles that Head error
Font size color. error mesage did you change your heading to green?
[solved]12. background color
Check yourself won't work
5.Link it up oops did you remember to link your....why won't it let me continue
23 psuedo selector
What am i doing wrong
[fixed #75] Make a Website - Building with Bootstrap - 6. Supporting Content - error: Invalid character
Build a Calculator! -- Make sure the button has the exact id 'button'
Can someone help me with my resume?
Images and links
Stuck- id's
Error message: Oops, try again
I can't add image to .html file in TextEdit on my computer
Having problem at level 10 font family
Site not letting me move on even though code is correct -- and where do I post my question?!?
Lesson 10 confusion with the href
18. Using a list of lists in a function
Own python project issues!
Problem with exercise - Nested Elements
What is the use of the div tag in this case?
FAQ & Troubleshooting [JavaScript]
Help with the course
Css is not linking to html
Html and css, Sorting your friends. Says pass but result not satisfactory
Wont let me succeed 13. Images and links
8. naming your table
Learn HTML & CSS Part 1, Step 1
Can you help me generlation exercize 5
23. Pseudo Selectors (again...)
Adding images
Since 11/13 I lost Run function
<!DOCTYPE> Still Doesn't Work
Question 13 (IMAGE AND LINKS
It's Better with a header
HTLM basic II 8 Front Size
4. Listing everybody
11.adding image
11.adding image
Problem with 26 links and decoration exercise
Third link is not hovering?
Images
Image et lien
Image et lien
Nav section
Image et lien
#2 Taking up Space display: block; bug?
CSS Overview Assignment - Glitch?
Help on taking a vacation 3
Help! I changed fon to Arial but the lesson won't recognize
11. Adding images. What is going on?
Review/23 Pseudo selectors isn't working
PHP server not responding in lesson 11 (portuguese vesion)
párrafo es 16px en vez de 44px
Class selectors
6: No ID, no entry
6: No ID, no entry
4/7 Stuck
4/7 Stuck
4/7 Stuck
Taking a vacation getting there
Add font family for the property selector hero
Can't save and send the code - unit 4
CSS A font of knowledge
Nothing is showing up in my preview box
"It's better with a header" Stuck
Nothing is showing up in my preview box
What is wrong with this code, I keep getting a message saying <li>'s font-size is 16px instead of 12px
HTML&CSS Basics UNIT 1- Less. 1, #11 Less.2, #2 WILL NOT accept correct answer
What's wrong with this code?
The issue is the same: here is the code
3. One selector to rule them all
Need help with exercise 2
CSS Selectors: Show it if you know it
14 Span is the Man
Link it up
HELP! 8 Font color
HELP! 8 Font color
Help cannot get passed font size!
Lesson one on building a website
Lesson 8 front size
Code puzzle
I don't see the problem with desing a button
Error message incorrect?
9. font-color
Font Size
9. font-color
Question about 8. Design a Button for your Website
6.5 "Did you add the link to the destination?"
Adding Images. The code won't submit even after putting space between .jpg and />
Whats is wrong in my code?
Exercise 4/6
10.Ending Up
How do you pass the font-size and family code?
Why is this code wrong
HTML/CSS lesson 9: is there a bug?
'Div'ide and Conquer
Exercise 7 where do I add the quotes
Not sure what I am doing wrong? (Link me)
Build a resume!
Oops, try again. Make sure your <span> tags only contains 'Impact' and nothing else!
Transportation Issue
Stuck on 13. Make sure at least one of your images is also a link
Looks like font size is 32 not 16. What am I missing?
Need help!
26. Links and Text Decoration
Html / css questão 16
FONT FAMILY I need help?
Help!
Lesson 26
#3 one sector to rule them all
"Your second <li's> font is 16px instead of 12px"
Stylizing heading and font-family colour
If,else and elseif - ARGH why doesn't my code work?
HTML II Basics: Font color Why isn't my header green?
Hello there!
Hello there!
Exercise 5. I can't find the mistake, can someone help me? D:
12. ID please CSS Selectors
8: One Selector, Many Properties. Error with Garamond font
Hello there!
5/7 Second For isn't Pushing Values to the Array
Problema en selectores de CSS capitulo 8
Unable to add space on top of my footer
Stuck on 25
HTML Basic 2 chapter 8
Build your own webpage #2
10. font family
Help
Lesson 15.Links
10.Ending Up
23 Many selectors, many properties
Struggles
Oops, try again. Did you give your third paragraph a font-size of 26px? It looks like it's currently undefined
18. need help
q3 on section 2 html basics
I'm having trouble with the adding images exercise
Changing font family
Introduction HTML III basics
Background image of the .main
11...The picture showed up on the right...why can't I proceed?
Exercice pierre, feuille, ciseaux
HTML video element 8/13
Please correct my code
Adding image problem
3- inline-block (CSS Positioning)
Final Product
AngularJS Instructions Step 4
Formatting a topic
Singup 1 part 4
How to loop Pig Latin Translator, when incorrect input entered?
30.What are objects for?
The Do's and Don'ts of Codecademy
General question re using jing in forum
Python Date and Time Grand Finale
LESSON 25 size and borders , 26 links and text decoration
Hey having a problem with the introductory course 8/12
Where to place <table> tags?
25. stuck
Java Methods II error
Wont let me pass
14. The color will not show up
Iterating over a list in a function interesting error
I'm confused
I need help with #12 on java!
Little doubt
Syntax Problems | Number 12
17/19 A Real Win
HTML Basics II 8 (Font Size) 'It looks like 16px'
10 You win
Making a Surface Area and Volume calculator
Problems with 4/6.redacted
Build a resume: overlapping header
Adding js and jquerry to a file
[FAQ] Common Problems #Read Me
Adding images
Lesson 5 A picture is worth a thousand words
6. is_prime
11/18 list manipulations in functions
Yoohoo! can anyone help me! something is wrong with my code!
6. Just weight and see
Why do I need tags?
"Practice Makes Perfect"
Inheritance
Everything
Logo and Nav in one line
Lesson 15 - Oops, try again. Make sure you put some text between your <a></a> tags!
Please help! I am having a problem with font size at this particular screen
Rails authentication - step 11/12
5. What am i doing wrong?
I can't figure out exercise 5 step 1
Dynamic Time Warping from Excel Workbooks
Image tag
Codeacademy Python 4/11 MadLibs
Oops, try again. Did you remember to change the first <li> to the font Arial?
Hi all (TRY TO UNLOCK my 4 digits code)
Text-Alignment in Ordered/Unordered Lists
Starting my portfolio with a resume made with my HTML and CSS knowledge
23.Pseudo selectors. whats wrong?
HTML BASICS ll
Adding images to your website
Can someone please show me how to nest the tags to change the font size?
Could someone help me with the font size lesson? (exercise 8)
6.5 Error: “Did you add the link to the destination?”
15. The Big If
Clickable Photo Page course: Unable to display images
Cannot pass lesson 2!
Im realy stuck! it says i havnt put in my <!DOCTYPE> what do i do!
<!DOCTYPE> Still Doesn't Work
Background color
Did you change the value of title to your own String?
Empty p tags
CSS Borders
What did i do wrong in my CSS?
Adding <em> and font-size and font-family
Background Color
5 Link it up
Can't pass adding image lesson 11
HTML & CSS Social Networking Profile- 5. Lists within lists
Code not getting submitted
Can anyone tell me what im doing wrong with <p></p> it keeps telling me no empty p tags
23. Pseudo Selectors
Stuck on Lesson 26 "CSS: An Overview"
CSS: An Overview Many Selectors, Many Properties
CSS: An Overview Many Selectors, Many Properties
Error
I need help in DATE AND TIME "GRAND FINALE"
I pass but when I click on the images they don't do anything lesson 13
To show an image
Div styles
Need help with Social Networking Profile
Guys help im really stuck with html and css part 1 lesson 3 6/6
I have a problem with setting the text-decoration to none
Html and css understanding
Can't continue
8. modifying member variables still stuck on this class stuff?
Need help with linking at will
How to center a nav bar
Please help me correct the error in my code. I keep on getting "uncaught syntaxerror: illegal return statement
Lesson 1. where can i know "my name"?
Indentation error:
Purify()
Python | Command Line Calendar. Indentation Error
Html question over here
Problem with whitespace lesson? wont let me advance
Html and css nav bar
Could somebody tell me what is wrong with code?
Create a JSX <article></article> element. Save it in a variable named myArticle
SleepDebt Calculator/ JavaScript functions
PLS help with my simple asssignment, a guessing game in python
PLS help with my simple asssignment, a guessing game in python
Elements and Structure 15/17: Videos
Please help me finish this html and php code
Can I concatenate and append the result in a single statement?
Rock paper scissors help
FAQ: Learn Java: Methods - Review
FAQ: Learn Java: Methods - Review
Modulo in Caeser Cypher
FAQ: Code Challenges: JavaScript Fundamentals - finalGrade()
The Object of Your Affections step 10
Guessing Game
Basic python coding