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.

36 Likes
Android Project: Dear Diary
Can't we just Add the Last Four Months All Together?
Https://www.codecademy.com/courses/learn-python-3/lessons/learn-python-function-arguments/exercises/positional-argument-unpacking
Sleep Debt Project - Task 12 returns Nan, why?
Https://www.codecademy.com/paths/data-analyst/tracks/dacp-python-fundamentals/modules/dscp-python-control-flow/projects/ds-python-controlflow-project
Python beginner needs help with a code
Struggling with the built in code for the See The Sale project
Lists and Functions - Battleship 14/19 Can't move on?
Can't find the logical error in UFO any help appreciated
Python 3 Functions - Physics Class project
MIDDLE ITEM - Understanding Solution
Practice Strings - m_word_count question
FAQ: Code Challenge: String Methods - X Length
How can I calculate a weighted average?
Meal Maker -- meals not saving to arrays
Function subLength()
Quick question about Table structure
Mystery Friend Chatbot Project
How do I get rid of the space inbetween the form and contact us
Can we overwrite a key?
Is there a reason to write a comment at the beginning inside the function?
FAQ: Working with Lists in Python - Adding by Index: Insert
FAQ: Introduction to Strings - Strings and Conditionals (Part Two)
Iterating through Strings - printing the counter
Language project
FAQ: Recursion: Python - Sum to One with Recursion
Removing a single head/tail node in Doubly Linked Lists
FAQ: Loops - The While Loop
Jamming project stuck on exercise 34
Jammming - after authentication, search is not working
Common email, password and Login issues
Why can I use the keyword "let" also for a variable name? Shouldn't it be reserved?
Syntax problem?
So...how is this a generative chatbot again?
Please, help me write the same JavaScript function with less code
PHP- removing excess digits using modulo (%)
Is there a way to open a file in both read and write?
Stuck with the 7th step of Dear Diary project
Non-static methods, (seemingly) not called on an object
Help error CS0165
Sams's Surf Shop
Not outputting string variable
Could you please help me by reviewing my code? Thank you!
Python control Flow Sals shipping issue
FAQ: Functions - Tackling Multiple Arguments
Classes - Build library stuck
Sal's Shipping - Float Issue!
FAQ: Recursion: Python - Stack Over-Whoa!
CS101 Python Gradebook Part 7
Help with the generator project
Stuck with VSC - CSS link
Button necessary for eventlistner?
Can i use function with multiple return value inside a function , as an argument?
Need to Help with J.S. Iterator and Loop. How to understand the use
Trouble with loops on the Hurricane Analysis project
I copy pasted the solution and got an error
Build a Library - Error
Courses/learn-python-3/lessons/learn-python-loops/exercises/while
Question 7 on the Number Guesser project
INTRODUCTION TO FLASK - Tourist Attractions
Https://www.codecademy.com/paths/data-science/tracks/dscp-python-fundamentals/modules/dscp-python-dictionaries-challenge-projects/projects/hurricane-analysis
FAQ: Introduction to Functions - Multiple Returns
Getting error string indices must be integers
CSS Styles error!
Number Guesser Project Help
Correct Change
Looping coffee chatbot, ex. 10 order_drink
Ongoing issues with main.js
Python dictionaries (data science - medical insurance project)
FAQ: Navigation - cd II
Scrabble project: What do I do to add words into dictionary
The Metropolitan Museum of Art - Case Statement
Question! about chatbots learning - coffee project
Sal's Shipping Project
Empty grid rows throwing off the layout
Question! about chatbots learning - coffee project
I'm stuck on Sleep Debt Calculator Javascript lesson>Step 9
Need help with mysterious organism step 7
Towers of hanoi project help
Advanced Python 3 Code Challenges Classes 1.Robot Inheritance
Terminal problem- jupyter notebook
SQLite installation issues
Python fund. "medical insurance project" #22
Help on "Build Basic Android Apps with Java" Capstone Project
Jamming # 11
Dotenv module error
Python Strings: Medical Insurance Project
Syntax Error
Syntax Error
Rock, Paper, Scissors Problem
JavaScript Whale Talk - 'E' and 'U' don't double
Accessing downloaded databases using sqlite3 on git bash
C++ Functions | Review of Functions help
Attributes ID
Medical Insurance Project, python Fundamentals
Number guesser project
FAQ: Introduction to Functions - Review
If else if statement
FAQ: Loops - 99 Bottles
Help required for Python Fundamentals: Medical Insurance Project - I'm not getting the same answers as the Hints
Error: "Did you add ‘font-weight: 700;’ to the class ‘.recipe-info-item’?"
Missing initializer
Sal's Shipping - Syntax Errpr
Rule-Based Chatbot --- AlienBot project
I have an error with my program that I don't understand to do with Loops
Animal Fun Facts Task 9
Python Strings: Medical Insurance Project
For loop spits out an extra value?
React not reloading on it's own
How can I create a new Animal object and use its description method?
Message Mixer: Type error
Which one is better optimized?
Jamming- Cannot read property 'map' of undefined
Cannot launch React project
Create-react-app not working
Errors on Choose Your Own Adventures
Learn SQL - Filter after aggregate by groups
List has no attribute: strip? (try a for loop)
Https://www.codecademy.com/courses/learn-python-3/projects/python-lens-slice
Rock Paper Scissors project, why 4 separate if statements?
I am new to c++ and dealing with a 'not declared' error
I deleted the folder called "tests" by mistake, how do i bring it back? (React Animal Fun Facts project)
[Learn more] Community Guidelines
Default values
Datetime.now()
FAQ: List Comprehension - Product
How do I "word wrap" long lines of code?
I don't get any output from my code
Python Code Challenges Lists (Advanced) Exercises 5
FAQ: Learn Python: A Day at the Supermarket - Lists + Functions
Thread Shed Project
Thread-shed making 4 copies of each of the lists
Cant see whats wrong
JavaScript Practice: Arrays, Loops, Objects, Iterators
FAQ: Rules of Probability - Addition Rule
Help with Python class assignment
Loops 10/13 - nested loops question
The Nile Project
Python Classes: Medical Insurance Project
Thread shed project - out of index error
JavaScript Arrays loops and Object Meal maker project
Python Dictionaries: Medical Insurance Project
I cannot find the error, I keep getting EOF errors as well as a syntax error!
Fundamentally confused about functions and return
SQL - Churn Rate Project
FAQ: Functions - Review: Functions
Python Classes: Medical Insurance Project
Python Strings: Medical Insurance Project Extra Task
When do you use 2 space indentation?
Credit Card Checker Project
Why does a variable needs to be declared to use a method that returns a value?
Python Classes: Medical Insurance Project
Https://www.codecademy.com/paths/computer-science/tracks/cspath-cs-101/modules/cspath-code-challenges/articles/advanced-python-code-challenges-loops
Censor Dispenser
Isa's fashion blog project learn html
Cumulative Project 4 (unquote)
Mysterious Organism help
FAQ: Linked Lists: Python - Linked Lists Implementation II
Message Mixer
Why doesn’t step 3 produce an index error?
Help
$ Not registering
FAQ: Code Challenge: Loops - Odd Indices
Rock Paper Scissors - keeps showing a "tie"
Importing library confusion
Coffeebot project - Name Error
Project Meal Maker Issue
FAQ: Code Challenge: Loops - Odd Indices
JS; creating a method, my red text should be blue, no?
EOF Error on Python 3 lesson (Sals shipping)
Error: " not supported for the input types "
Sal's Shipping Project - None
My Workspaces javascript
Python 3: Advanced Python Code Challenges: Lists - range() problem
Sports Vector Machines data science project, function-writing trouble
Rock Scissor Paper Project HELP
FAQ: Taking a Vacation - Pull it Together
How to select only last names?
FAQ: Introduction to Functions - Review
FAQ: Functions - Return
Rock, paper or scissors error
Games of chance: money value
Bank teller project
Build Coffee bot using python (Module 1)
Orion Constellation Project
A/B Testing for ShoeFly.com question 5
What is wrong with this code?
Calculating Financial Statistics : Help to iterate properly the lists of return
The order of items in a combined list of lists
Confused with functions
Thread Shed
FAQ: Introduction to Functions - Returns
My Result does not show the time in rounded, the function created estimated_time_rounded seems doing nothing in this result, is there anything I miss, I tried to remove that function and still the result comes
Why it is not returning as a list?
FAQ: PygLatin - Word Up
Could this be solve with list comprehension?
Help Sal's Shipping
Multiple colors Bounce Bubbles
Python
FAQ: Control Flow - Relational Operators II
Help with Number Guesser
Dice program help
Functions - Rock, Paper, Scissors
Need help in the First Three Multiple Challenge C++
Building Interactive JS Websites, Bot only appearing in one order
Stripping white space from a list within a list
Python NumberGuess.py Game - Help needed
Solutions
Codecademy coding challenge - JS number guesser
FAQ: Learn HTML - Intro to HTML - Headings
Chore Bot - Rolls bot first every time
Rock, Paper, Scissors
Rock paper scissors help
Can you help me understand why my code doesn't work?
Sal's shipping python control flow
Indention in HTML -images
FAQ: Learn Java: Methods - Review
My Python function won't run
FAQ: Loops - 99 Bottles
Guessing Game
Number Guesser for Javascript
Difference between low, high and low_limit, high_limit?
Best Fare Calculator
Lists and Loops return
New York City Blog Project: problem with <article>
Noob coding question
What is the use of the div tag in this case?
PLS help with my simple asssignment, a guessing game in python
Please help me finish this html and php code
Create a JSX <article></article> element. Save it in a variable named myArticle
FAQ: Learn Python - Lists and Functions - Iterating over a list in a function
Lesson 1. where can i know "my name"?
How to center a nav bar
Python | Command Line Calendar. Indentation Error
Purify()
Could somebody tell me what is wrong with code?
Html and css nav bar
Indentation error:
8. modifying member variables still stuck on this class stuff?
Can anyone tell me what im doing wrong with <p></p> it keeps telling me no empty p tags
Need help with linking at will
I have a problem with setting the text-decoration to none
Guys help im really stuck with html and css part 1 lesson 3 6/6
Learn HTML & CSS Part 1, Step 1
CSS: An Overview Many Selectors, Many Properties
Aisha's Greetings
Stuck on Lesson 26 "CSS: An Overview"
Code not getting submitted
I need Help
8. naming your table
CSS: An Overview Many Selectors, Many Properties
5 Link it up
HTML & CSS Social Networking Profile- 5. Lists within lists
Div styles
I pass but when I click on the images they don't do anything lesson 13
Adding images
23. Pseudo Selectors (again...)
Need help with Social Networking Profile
I need help in DATE AND TIME "GRAND FINALE"
To show an image
Error
Site not letting me move on even though code is correct -- and where do I post my question?!?
Having problem at level 10 font family
I can't add image to .html file in TextEdit on my computer
<!DOCTYPE> Still Doesn't Work
<!DOCTYPE> Still Doesn't Work
Can't pass adding image lesson 11
Wont let me succeed 13. Images and links
Stuck on 25
Html and css, Sorting your friends. Says pass but result not satisfactory
Help on taking a vacation 3
Background Color
Error message: Oops, try again
CSS Overview Assignment - Glitch?
Question 13 (IMAGE AND LINKS
Can you help me generlation exercize 5
What did i do wrong in my CSS?
Clickable Photo Page course: Unable to display images
Cannot pass lesson 2!
6.5 Error: “Did you add the link to the destination?”
Can someone please show me how to nest the tags to change the font size?
HTML BASICS ll
Starting my portfolio with a resume made with my HTML and CSS knowledge
Text-Alignment in Ordered/Unordered Lists
Codeacademy Python 4/11 MadLibs
HTML Basics ll 11/16 I don't get the Error: Oops, try again. Did you remember to set the font-family to Arial?
Background color
Image tag
11/18 list manipulations in functions
6. is_prime
Formatting a topic
Im realy stuck! it says i havnt put in my <!DOCTYPE> what do i do!
15. The Big If
Could someone help me with the font size lesson? (exercise 8)
I can't figure out exercise 5 step 1
5. What am i doing wrong?
Rails authentication - step 11/12
Please help! I am having a problem with font size at this particular screen
Adding images
Can someone help me with my resume?
General question re using jing in forum
Lesson 15 - Oops, try again. Make sure you put some text between your <a></a> tags!
"Practice Makes Perfect"
6. Just weight and see
Where to place <table> tags?
Hey having a problem with the introductory course 8/12
HTML video element 8/13
30.What are objects for?
AngularJS Instructions Step 4
3- inline-block (CSS Positioning)
Build a Calculator! -- Make sure the button has the exact id 'button'
11...The picture showed up on the right...why can't I proceed?
Oops, try again. Did you give your third paragraph a font-size of 26px? It looks like it's currently undefined
Singup 1 part 4
Final Product
Background image of the .main
Help!
Java Methods II error
6.5 "Did you add the link to the destination?"
Image et lien
q3 on section 2 html basics
5/7 Second For isn't Pushing Values to the Array
Hello there!
HTML II Basics: Font color Why isn't my header green?
FONT FAMILY I need help?
Looks like font size is 32 not 16. What am I missing?
Transportation Issue
Build a resume!
Help cannot get passed font size!
If,else and elseif - ARGH why doesn't my code work?
Lesson 26
Html / css questão 16
Exercise 4/6
Taking a vacation getting there
PHP server not responding in lesson 11 (portuguese vesion)
Help! I changed fon to Arial but the lesson won't recognize
Image et lien
Nav section
Show a tag 5/9
MOVE (supporting - how to get text to go inline)
It can't see my <!doctype> tag
Logo and Nav in one line
Edit and test statements in Python
Indentation error in else statement
Member function not declared
How does the indentation level of `return False` change the code?
Help with Anagram Finder | C
FAQ: Introduction to Functions - Multiple Returns
AlienBot project
Python 3 course: Strings section: Thread Shed project
Ideas for a method of creating a dictionary from existing object attributes
Shared stylesheet.css not allowing my top navigation bar to work
Number guesser challenge / can't pass task 7
Flask. problem with for loop inside the route function
FAQ: Introduction to Functions - Multiple Parameters
Sleep debt calculator
FAQ: Conditionals & Logic - Review
School Catalogue (Learn Intermediate Python 3)
INSERTING into SQLite 3 with Python
What is wrong with my code (C++)
Analyzing User Churn Sql skill path
Java variables: madlibs project will not print!
Python code not showing output
FAQ: Learn Python: Files - Writing a JSON File
What's the difference between these?
Personal Python project if statement problem
Property decorate struggle
Calculate the interest
Credit Card Checker Challenge Project (JavaScript)
Why does .join() not end with the delimiter?
[HELP} Unable to display axis labels
Question on Step 5 of Medical Insurance Project extra task (Python Control Flows)
Wanderlust: Invalid left-hand side assignment
Dasmoto: Background image and price
For i in range(): error
Why does circumference require ()?
Python Graph Search on Jupiter Notebook – How is this possible?
TeaCozy Layout with Flexbox project?
Why does my python find() print say 20
Robot Race - runtime error in Codecademy environment not replicated on my own PC
When you create a new instance of a class, where in the file is it available?
Multiple Tables with Reddit
Python 3 project , Basta Fazoolin'
My Blackjack (Attempt)
Stuck on Curious Ornithologist question 2
Need help understanding TypeError: this.props.tracks is undefined
My links will show up on my webpage but won't work when I click them
HTML video not displaying/playing properly
FAQ: Vectors - Review
Javascript syntax partIII: build a library project, ratings not defined
Intermediate JS ES6 Import/Export topic projecgt
What happens if I directly add the `<li>` without adding the `<ul>`?
Getting started with an assignment for a job interview - JS
Need help with Chore Door
For loop
FAQ: Learn HTML - Intro to HTML - Attributes
Python 3 Intermediate - School Catalogue Project
Why is my code not working what am-I missing?
Loop Challenge, please find the bug :)
Multiple Tables with Reddit Q 6
MadLibs Java Project Issues
What's wrong with this if statement?