[How to] Format code in 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, (2) 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 or commonmark.org.

27 Likes
7. Adding images
How can i change the style of color
Saving data lesson 4
Working with Python List: Medical Insurance Project
I need help
10. Divs & classes - cannot reset
Social Network - paragraph doesn't work
How do you add a link in 6/15? i'm terribly stuck
7 More Link Attributes
<!DOCTYPE html> <html> </html>
Return original
Self closing tags part 2/18
Html & css Lesson 13 HELP!
Stuck in Hello Sass nesting 5/9
Is the Final / Finished code available for comparison?!
In lesson 7/13 photo is not opening and after click on run it show Did you use second image URL?
My title never appears
How do I format my code?
CSS Please help!
12. Check yourself before you Wreck yourself. HELP!
Exercise 5 how do you do it?
CSS: An Overview A font of knowledge I NEED HELP CHANGING THE HEADERS
Link coding
Stuck on 23
Background won't change to brown
Floating left and right
8: Part of the Whole. What am I doing wrong?
Can someone help me with adding the Unordered list?
Name = raw_input("What is your name?") quest = raw_input("What is your quest?") color = raw_input("What is your favorite color?") print "Ah, so your name is %s, your quest is %sand your favorite color is %s" %(name, quest, color);what wrong in this code?
[Challenge] Unique Characters in a String
[Challenge] The Classic FizzBuzz Challenge
[Challenge] Anagram Detector
A bug about: Exercise 5-The CSS Setup (Learn HTML&CSS)
[Challenge] Reverse Words
Help with CSS for Course assingment : Nav section background color not showing up
Image attributes for visually impaired
[Challenge] Egg Dropper πŸ₯š
[Challenge] Change Please
Https://www.codecademy.com/courses/learn-python-3/lessons/data-types/exercises/review
[Challenge] Comparative Weights βš–οΈ
[Challenge] Print Times Tables πŸ–¨βŽ
JavaScript error: Uncaught SyntaxError: Unexpected end of input
Return II , followed instructions to the dot, but still having problems
[Challenge] Stairmaster πŸ“Ά
Font weight bold
6/7 code won't run
Link to destination
What;s wrong with my code?
Divid and conquer
Functions > Return || (6/7)
[Challenge] Calculate Max, Min, and Averages πŸƒ
Switch
[Challenge] Fibonacci Finder
Error in Functions! - Pizza getTotal
Comma Separated List
Common elements Exercise 11/15
Could somebody hepl me pezl
7/13 this.props.7/13 this.props. Why do we have to include function in class definition, what happens if a function is outside of a class passed as props to other component?
[Challenge] Flatten an Array β™­
Essential Information on Code Challenges
[Challenge] Palindrome Detector
[Challenge] Find the Missing Number πŸ”Ž
8.images- image not appearing-help! :/
[Challenge] Palindrome Detector
HTML Basic Lesson 15/17
"expected [Function" error
[Challenge] Top Score Sorter
Problem with prompt task in Javascript lesson
Set up the albums#show controller action in the Bass Music project
CSS font-weight property
26. link and text-decoration
Javascript, 'for loops inside for loops '
17.review functions NEED HELP
[Challenge] Select a number, any number
Else if statements
What's the difference?
How is this supposed to look with one parameter orderCount
15. Same Page. unordered lists
Pygame help
Quiz in java script
[Challenge] Product of Everything Else
PLS help with my simple asssignment, a guessing game in python
PLS help with my simple asssignment, a guessing game in python
5/7 for loops inside of for loops
ArrayList String problem
Poker tournament app
FAQ: Learn HTML - Intro to HTML - HTML Structure
Reduce method - Bild a Library
Parts of my code, where I have comments, go bold
Position:fixed; is making my navigation bar disappear
Task Board Project
My Edit of Mysterious Organism (JavaScript Object Challenge)
Python, how to replace a text from a file between two tags?
Name 'x' is not defined. in pygame
Grade Analyzer: methods for the lowest or highest class grade
What's JavaScript Thinking Here?
Need help please, can't make return or variables
Problem Solving
JavaScript Interactive Websites - Chore Door Project
How can I access a dictionary key value inside of a loop?
How to ask a good question
[Challenge] Anagrams
Escape keys
FAQ: Natural Language Parsing with Regular Expressions - Review
How to share projects?
FAQ: Semantic HTML - Audio and Attributes
Plz help me
Help me i got a syntax error and I'm not sure what I missed
Meal Maker undefined and NaN
Why Does This Print Statement Not Execute?
How to Use the Codecademy Community Forums
Someone please let me know where is the error in my code
6. Is this a trick or something
Hurricane Analysis Project - Areas Affected Dictionary creation
Inheritance
CSS Grid + Fixed Position (aka "keep the nav bar when scrolling")
Am stocked at 5/13 - HELP MOVED TO 8/13
<!DOCTYPE html> error
Does anyone know why in the constructor (self.full = name + version ) why name + version doesn't have to be self.name + self.version?
Can anyone give me some tips on making this liltle program smaller
Need plain simple straight forward simple to understand formatting instructions
FAQ: Learn Bash Scripting - Review
Python magic 8 ball
Connect Google Font
Sleep Debt Calculator – My code works, but it is saying undefined
Advanced Python Code Challenges : Control Flow
How does `edit_message` know to reference the `Message` class?
Hey im new to learning python and im having trouble solving this assignment can you guys help me>?
Why always begin new lines with std: :cout<<
Homework java
Website Project for school
True or False? project
LOOPS Same Values
If elif for Grade Convertor
Rock, Paper & Scissors Project - Error message
Does this achieve the same thing?
Manipulating Functions
Return error on loop code challenge 5/11
Project Review Please provide the review on my code thanks
Print a function with a print statement in it
Bordeless Tourist Challenge
Blossom Project
Create Purchasing Information and Receipts for Lovely Loveseats Python
Noob coding question
Try block in "The Boredless Tourist"-challenge failing
Race Day -
Wanderlust - multiple syntax errors
Number Guesser Challenge - what's wrong with my code
Meal maker - Cannot read property 'length' of undefined
The Boredless Tourist
Magic eightball project
Project: Kelvin weather need help
FAQ: Linked Lists: Python - Linked List Implementation III
FAQ: Taking a Vacation - Plan Your Trip!
FAQ: Learn Java: Methods - The toString() Method
Credit Card Checker : some issue with my code
FAQ: Code Challenges: Intermediate JavaScript - isTheDinnerVegan()
Please check and advise other ideas or options
Rock, Paper, Scisssor - Issue JS
Number guesser project
Why can't I use object name directly instead of 'this' keyword?
Dasmotos Arts & Craft project background image not loading
Help on "WorkAround Explorer" Project in Modules section
Codewars - Kata problems
Looping list students_period_A to combine students_period_B
New_input() not loading in console
How to get a sum during a loop
Need to fix slideshow and figure out responsiveness. only CSS/HTML
Help!Medical Insurance Project
Rock Paper Scissors question bracket quesiton
Magic 8 ball project question - Why $userName not being recognized?
[Extreme] Tolerant String Matching Python Challenge (not for beginners)
Mixed Messages: Bad Advice generator
.friend class border
Bug in HTML Basic Session II: 8. Fonts
Is anyone here? I need help. Is this an internal error? Seek to save
CSS: An Overwiev, point 9
For the Record
FAQ: Conditional Operators - Review
4. The sum of scores
Dictionaries.update({key:value}) option