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 trialKieran Barker
15,028 PointsWhat’s the point of Markdown?
I know what Markdown is for — easily converting plain text to HTML — but what’s the point? Why not just write HTML in the first place without adding this seemingly unnecessary step? When might I actually use Markdown?
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey there,
Markdown is used in many places, and it is especially useful when HTML is forbidden and blocked. An excellent example is The Treehouse Community where this question is posted. You cannot add HTML to the question, comments, or answers, and without Markdown, things can get very very messy and unreadable.
Here is an example of a code snippet taken from a Java challenge here on Treehouse without using markdown.
public class Order { private String itemName; private int priceInCents; private String discountCode;
public Order(String itemName, int priceInCents) { this.itemName = itemName; this.priceInCents = priceInCents; }
public String getItemName() { return itemName; }
public int getPriceInCents() { return priceInCents; }
public String getDiscountCode() { return discountCode; }
public void applyDiscountCode(String discountCode) { this.discountCode = discountCode; } }
When I paste it in, it looks perfect in the draft until it is posted, because the post (or answer in this case) is converted to HTML to be displayed and whitespace doesn't matter in HTML, so everything just gets "smushed".
And with Markdown (in this case --> a code block using backticks and language name)
public class Order {
private String itemName;
private int priceInCents;
private String discountCode;
public Order(String itemName, int priceInCents) {
this.itemName = itemName;
this.priceInCents = priceInCents;
}
public String getItemName() {
return itemName;
}
public int getPriceInCents() {
return priceInCents;
}
public String getDiscountCode() {
return discountCode;
}
public void applyDiscountCode(String discountCode) {
this.discountCode = discountCode;
}
}
Even line breaks cannot be added properly without using Markdown. For example and without Markdown.
Line One Line Two Line Three
But with markdown...
Line One
Line Two
Line Three
If you want more examples, places used and the importance of Markdown to Web Development, I recommend taking the Markdown Basics Course here on Treehouse.
Keep Coding! :)
(The emoji could also not be added without markdown unless you use an emoji keyboard, which I do not)
Kieran Barker
15,028 PointsKieran Barker
15,028 PointsThanks, Jason, and sorry for the late response!