Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPaul Dietrich
4,557 PointsHow to type code in the forum
Hi guys,
I think I've asked this about three times or so already, and I keep forgetting: how do I add code to the forum and place it in a box? I've seen that it's maybe < code> </ code> or putting " ``` " before the text, but those don't work for me.
Is there a way to have a feature where you can highlight the code in the textbox and hit a "Code Tag" button? I'm perfectly fine with writing the code myself, but I just keep forgetting the actual command to do so.
Thanks.
Viraj Kokane
17,531 Points<Body>
<p>hello world</p>
</body>
Viraj Kokane
17,531 Points`<Body> <p>hello world</p> </body>'
Viraj Kokane
17,531 Points<body>
<p>hello world</p>
</body>
Viraj Kokane
17,531 Points<body>
<p>hello world</p>
</body>
Ryan Schurton
13,815 Points<p>hello</p>
Cameron O'Brien
11,564 Pointstelnet httpbin.org 80
GET / HTTP/1.1
Host: httpbin.org
test
108 Answers
James Barnett
39,199 PointsPaul Dietrich - There are 3.5 different ways to format code on the forum, here's a primer for you.
Option 1) Inline code like this code
use the ` key to enclose your string of code
Option 2) Indent each line of code by one tab or 4 spaces
<Body>
<p>hello world</p>
</body>
Option 3) Code fences, you need a blank line before your code fence
Enter this:
```
<body>
<p>hello world</p>
</body>
```
It will give you this:
<body>
<p>hello world</p>
</body>
Option 3b) Syntax highlighting, use the code fences and specify a language:
Enter this:
```ruby
def my_method(syntax)
syntax.is_highlighted?
end
```
It will give you this:
def my_method(syntax)
syntax.is_highlighted?
end
Zac Gordon
Treehouse Guest TeacherTest 1:
<article>
<h1><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
<br>
</article>
Test 2:
<article>
<h1><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
<br>
</article>
Adam Waite
3,996 PointsTest code block:
var myVar;
undefined = true;
Patrick Koch
40,496 PointsTest <html> <title>Code Block Test</title> <body> </body> </html>
Patrick Koch
40,496 Points<body>
<p>hello world</p>
</body>
jamestoynton
10,992 PointsTest
CELLS = []
for x in range(0,10):
for y in range(0,10):
CELLS.append((x,y))
Alberto Castro
9,311 Points<Body>
<p>hello world</p>
</body>
Dom Farnham
19,421 Points,,, Test ,,,
Spen Taylor
13,027 Pointsas in :
code?
4 spaces should the trick, although I find I have to go back and edit some lines of code, but thats probably my bad anyway!
Spen Taylor
13,027 Pointsor that ^ James Barnett ;D
James Barnett
39,199 PointsPaul Dietrich - Your issue with '```' is probably you aren't putting the necessary, 1 line of white space between your text and the start of your code block.
Suleiman Leadbitter
15,805 PointsThis is how I imagine Prof Stephen Hawkins to type by default
:/
Paul Dietrich
4,557 PointsThanks much!
Alan Cousins
434 Pointstest
Brian Story
Courses Plus Student 2,148 Points <html>
<title>Code Block Test</title>
<body>
</body>
</html>
Bryan Heredia
7,777 Points<html>
<head>
<title>Something</title>
</head>
<body>
<p>Something Else</p>
</body>
</html>
Unsubscribed User
18,288 Points<code>
Viraj Kokane
17,531 Points`<html> <head> <title>Something</title> </head> <body> <p>Something Else</p> </body> </html>'
James Barnett
39,199 PointsHere are a few other Github-flavored markdown tricks:
You can use numbers for reference-style link definitions
You can even create reference-style links with parentheses in them
Strike through with ~~done~~
done
H1
Headers with equal signs underneath.
Alt-H1
this is only a test
Mike Casteel
7,960 Points<body>
<p>hello world</p>
</body>
TEST
Paul Yorde
10,497 Points<html>
<!-- A < a -->
</html>
Anton Kalenik
4,639 Pointstest
def my_method(syntax)
syntax.is_highlighted?
end
Anton Kalenik
4,639 Points<html>
<title>
</title>
</html>
Andy Simmons
Courses Plus Student 3,734 PointsTest
<html>
<head attr="someValue">
</head>
<body>
Some text
</body>
</html>
Carlos Fernando Gómez Carrero
46,984 Pointstest
<html>
<head>
</head>
<body>
<p>HELLO</p>
</body>
</html>
Jonathan Stoppi
1,577 Points<body>
<p>Hello World</p>
</body>
eck
43,038 Points<p>
HELLOOO
</p>
Arsallan Shirvani
3,852 PointsTesting...
<html>
<head>
<title>The Grid</title>
</head>
<body>
<p>
The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? Motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day... I got in.
</p>
</body>
</html>
Alice Barton
1,053 Points<body>
<p>hi there, this is a test</p>
</body>
Chris Scott
7,673 Points<body>
<p>hi there, this is a test</p>
</body>
Megan Boyd
1,210 Pointstest
<body>
<p>hi there, this is a test</p>
</body>
Josh Hicks
14,146 Points<body>
<p>Hello Test!</p>
</body>
Tuan Hoang
4,500 Points<!DOCTYPE html>
<head>
<title>This is only a test</title>
</head>
<body>
<p> This is a paragraph </p>
</body>
Test 2
<?php
$args = array(
'post_type' => 'work'
);
$the_query = new WP_Query( $args );
?>
Umar Alkhamis
1,068 PointsThis is a test
<body>
<h1>This is a level 1 headline</h1>
</body>
Raissa de Guzman
645 PointsTesting!
<p>Hello hello </p>
Steven Knapp
Courses Plus Student 773 Points=-
Josh Hicks
14,146 Points<body>
<p>test</p>
</body>
Jonathan Carroll
3,438 Points<body>
<p> hello world </p>
</body>
Will Vincent
2,594 Points<body>
<p> hello world </p>
</body
Will Vincent
2,594 Pointsthis is a test:
<body>
<h1>This is A test</h1>
Tadeusz Krawczyk
2,088 PointsTest
<h1>Hello</h1>
<p>hello world test</p>
Tyler McNally
1,560 PointsTest test test
<h1>I'm So Cool</h1>
<p>Treehouse rules!</p>
Vernon Watson
8,854 PointsTEST
SELECT movies.title, IFNULL(AVG(score),0) AS average
FROM reviews RIGHT OUTER JOIN movies
ON movies.id = reviews.movie_id
GROUP BY movie_id HAVING average < 2;
Ryan Salmons
4,925 Points<h1>Test</h1>
Abraham Sanchez
5,962 PointsThis is a test
@property(strong,nonatomic) NSMutableArray *arrayTest;
Awesome lol
Grant Thornbury
4,135 PointsTesting...
#copyright {
border-top: 8px solid;
border-color: #2A0400;
}
Grant Thornbury
4,135 PointsOne more...
#copyright {
border-top: 8px solid;
border-color: #2A0400;
}
James Gill
Courses Plus Student 34,936 PointsDoesn't the simple Markdown code block notation of a tab (or 4 spaces) work?
James Barnett
39,199 PointsJames Gill - As I noted in option 2, yes it does a tab or 4 spaces works the same way as using a single backtick. If you want to do multiple lines you need a code fence or a set of 3 backticks as I noted in option 3.
Any questions?
James Conner
9,821 Pointstrying to put a block of code here...
<body>
<p>A paragraph</p>
</body>
James Conner
9,821 Pointsround two <body> <p>A paragraph</p> <body>
used 4 spaces... we'll see!
James Conner
9,821 Points????
<body>
<p>A paragraph.</p>
<body>
James Conner
9,821 Pointsahhhh... that works.
Erik McClintock
45,783 Points<html>
<head>
<title>Testing</title>
</head>
<body>
<p>Here's another test.</p>
</body>
</html>
Erik McClintock
45,783 Points<html>
<head>
<title>Test w/o Indentation</title>
</head>
<body>
<p>Does it look right?</p>
</body>
</html>
Erik McClintock
45,783 Pointstesting <code>code</code>
John Schnettgoecke
2,012 Pointstest
''' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen"> </head> '''
John Schnettgoecke
2,012 Points'''html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen"> </head> '''
Chase Lee
29,275 PointsJohn Schnettgoecke you need to use a backtick `. You're using a single quote.
Ana Paula Daros
8,436 Points<body>
<p>Test</p>
</body>
David Bilson
13,819 PointsJust a test!
@media screen and (max-width: 300px) {
#myItem li:nth-child(2n+1) {
clear: left;
}
}
Alastair Halliday
249 Pointseven more testing
void addTwo(){
// float alpha = 1.11;
float beta = 2.22;
//float result = alpha + beta;
printf("result is %f\n", beta);
}
Joshua O'Connor
Courses Plus Student 3,207 Pointstest
float addTwo (float a, float b);
float addTwo (float a, float b){
return a + b;
}
Tamsin Waters
6,116 Points test
<li>
<a href="img/summer.JPG">
<img src="img/summer.JPG" alt="">
<p>Summer Album</p>
</a>
</li> '
Ben Dietrich
3,604 PointsJust a test!
<body>
<p>hello world</p>
</body>
Kirk Woodill
7,078 PointsTest
<html>
<body>
<div>
<p>Hello!</p>
</div>
</body>
</html>
Kirk Woodill
7,078 PointsTesting again
test test
Julio Pereira
7,459 Points'''html <body> <p>hello world</p> </body> ''''
This is a Venezuelan Test!
Julio Pereira
7,459 Points <p>This is code!</p>
Julio Pereira
7,459 Pointsok, got it!
Cesar Vanbuskirk
6,672 Points h1 {
color:blue;
}
Adam Arvidsson
7,318 Points <p>Testing World</p>
Jermaine Witter
33,087 Points<p>This is a test</p>
Jermaine Witter
33,087 Points<p>This is another test</p>
Juan Martin
14,335 Points<Body> <p>hello world</p> </body>
def my_method(syntax)
syntax.is_highlighted?
end
Juan Martin
14,335 Pointstest
def my_method(syntax)
syntax.is_highlighted?
end
Juan Martin
14,335 Pointstest
def my_method(syntax)
syntax.is_highlighted?
end
Juan Martin
14,335 Points<p>hello</p>
def my_method(syntax)
syntax.is_highlighted?
end
Juan Martin
14,335 PointsThis is an example link ```ruby def my_method(syntax) syntax.is_highlighted? end
Juan Martin
14,335 PointsThis is an example link
def my_method(syntax)
syntax.is_highlighted?
end
lukebiggerstaff
27,534 Points<!DOCTYPE html>
<html>
</html>
Thunthon Monkata
Courses Plus Student 2,395 Points<p> test code</p>
Umar A
4,041 Points<p> this is just a test </p>
Travis DePriest
696 Points<p>Test</p>
Travis DePriest
696 PointsTest
<body>
<p>hello world</p>
</body>
Kristopher Keen
9,992 PointsThis is a test.
shopping_list = []
def show_help():
print("What should we pick up at the store?")
print("Enter DONE to stop. Enter HELP for this help. Enter SHOW to show list")
def add_to_list(item):
shopping_list.append(item)
print("Added! List has {} items.".format(len(shopping_list)))
def show_list():
print("Here's you list:")
for item in shopping_list:
print(item)
hope it works.
Eric Vandenberg
9,095 Points<button type="button">Test</button>
Philip Campbell
15,324 PointsTesting.
<body>
<p>Test</p>
</body>
Fuad Adetoro
iOS Development Techdegree Student 11,599 Points' <body> <p>Test</p> </body> '
Dominik Sikiric
2,059 Pointsvar userNumber = prompt("write down one number");
parseInt(userNumber);
var sve = Math.random()*userNumber;
Math.floor(sve);
alert(Math.random()*userNumber);
Adam Bell
1,176 Points'test <li> <a href="img/summer.JPG"> <img src="img/summer.JPG" alt=""> <p>Summer Album</p> </a> <'
Adam Bell
1,176 PointsString firstName = "Gordon";
// string lastName = "Sumner";
// console.printf("Hello %s", firstName)
// band = console.readLine("Which band? ");
Adam Bell
1,176 Points^ was just practicing
Evan Fraser
6,789 Points<p>Test</p>
Derek Markman
16,291 Points<?php
require "vendor/autoload.php";
date_default_timezone_set("America/Cancun");
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$log = new Logger('name');
$log->pushHandler(new StreamHandler('app.txt', Logger::WARNING));
$log->addWarning('Warning!.');
echo "Hello World!";
Juan Martin
14,335 Points<p></p>
var a = "hello";
Viraj Kokane
17,531 Pointstesting
`
Jordan Hudson
2,977 Points<test> hello </test>
Sarah Lorenzen
11,811 Pointstesting 1, 2, 3
Marty scheid
1,589 Pointspublic class Game {
private String mAnswer;
/// final means cannot be changed alcaps MAS_MISSES means constant\\\\\
public static final int MAX_MISSES =7;
private String mMisses;
private String mHits;
//constructor\\\
public Game(String answer) {
mAnswer = answer;
mHits = "";
mMisses = "";
}
// private method\\\
private char validateGuess (char letter) {
if (! Character.isLetter(letter)) {
throw new IllegalArgumentException("A letter is required");
}
letter = Character.toLowerCase(letter);
if (mMisses.indexOf(letter) >= 0 || mHits.indexOf(letter) >=0) {
throw new IllegalArgumentException(letter + "has already been guessed");
}
return letter;
}
///method\\\
public boolean applyGuess(char letter) {
letter = validateLetter(letter);
boolean isHit = mAnswer.indexOf(letter) >=0;
if (isHit) {
mHits += letter;
} else {
mMisses += letter;
}
return isHit;
}
public String getCurrentProgress() {
String progress ="";
for (char letter: mAnswer.toCharArray()) {
char display = '-';
if (mHits.indexOf(letter) >= 0) {
display = letter;
}
progress += display;
}
return progress;
}
public int getRemainingTries() {
return MAX_MISSES - mMisses.length();
}
}
Hector F.
27,464 Points'' test ''
Hector F.
27,464 Points'' test ''
Hector F.
27,464 Points´´´´´gdfgdfg´´´´
James Ackerman
14,099 Points<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Objects</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Objects</h1>
<div id="output">
</div>
<script src="js/object.js"></script>
</body>
</html>
Anthony Rice
7,976 PointsTest
<body>
<p>hello world</p>
</body>
Faisal Julaidan
13,944 Pointstest '''
HI
'''
Mariah Weathersby
1,404 Pointstest
angular.module("todoListApp",[])
.controller("mainCtrl", function($scope, dataService){
$scope.addTerm = function(){ };
dataService.getCloudTerms(
function(response) {
console.log(response.data);
$scope.cloudTerms = response.data;
console.log($scope.cloudTerms);
}
);
})
.service("dataService", function($http){
this.getCloudTerms = function(callback){
$http.get('data/cloudTerms.json')
.then(callback);
}
})
John Schaub
5,167 Points'<p>This is only a test</p>'
Kyle Vassella
9,033 PointsI think they really need to include the Markdown Cheatsheet link into the dialogue box when you are trying to start a thread from a video's question section. That would be a (seemingly) easy, huge improvement to the site's functionality.
Michelle Wood
1,667 Points'''python
test = this_is_a
'''
Philip Schultz
11,437 Pointstest
do
{
System.out.println("Please enter your name: ");
name = ScannerObject.nextln();
if(!(name.matches["a-zA-Z+"]))
{
System.out.println("Sorry, the name can only consist of alphabetical characters... please try again");
}
}while(!(name.matches["a-zA-Z+"]))// this while loop
Jose Carlos Garcia Zafra
2,090 PointsHi there this is just another html test:
<body>
<p>Hello world I am a paragraph just like those Lorem ipsums</p>
<ul>
<li>tomatoes</li>
<li>oranges</li>
</ul>
</body>
mohamadreza azadi
5,167 Points'''java
this is test '''java
mohamadreza azadi
5,167 Points' ikkk '
Gabriel Rojas
1,380 Points... <body> <p>testing<p> ...
Gabriel Rojas
1,380 Points... <body> <p>Hello world I am a paragraph just like those Lorem ipsums</p> <ul> <li>tomatoes</li> <li>oranges</li> </ul> </body> ...
Gabriel Rojas
1,380 Points<p>This is code!<p>
Jan Oberreiter
78,020 Pointsjust a test ...
<body>
<p>"Hello"</p>
</body>
Kevin Narain
11,379 PointsJust for practice.
<!DOCTYPE html>
<html>
<head>
<title>The Moon</title>
</head>
<body>
<figure>
<img src="img/moon.jpg" alt="Hello snitch">
<figcaption>Hello snitch</figcaption>
</figure>
</body>
</html>
Tamara Reynolds
1,238 PointsTamara Reynolds
1,238 Points<strong>test</strong