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 trial
Andrew McCormick
17,730 Pointstrouble with forum code
Am I the only one that has trouble getting code to format in the forum. Seems like sometimes it works, and sometimes it doesn't. (of course it will probably work fine when I post on here). The backticks work great for a line or two in mid paragraph to change code area to teletype and leave code intact. However putting in blocks have been an issue.
Examples (each of these should be a block of three lines: Using three back-ticks (tilde) on the line before and after
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
Using backticks with language (html) specified
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
Indenting each line with four spaces (tab moves courser to next option on page): <div id="somecode"> <h1> Mike the Frog </h1> </div>
7 Answers
Andrew McCormick
17,730 PointsWell using the four spaces above didn't even show up :( .
Now see if Mac or PC makes difference.. above was using PC with Chrome
now Mac with Chrome and backticks
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
nope. no difference. pasting in from Workspaces?? <div id="somecode"> <h1> Mike the Frog </h1> </div>
^^ nope, block didn't even show up
Andrew McCormick
17,730 Pointscopying and pasting from code editor (notepad++ <-- don't judge) that i used to indent block: <div id="somecode"> <h1> Mike the Frog </h1> </div>
Andrew McCormick
17,730 Pointscopied directly from 'markdown cheatsheet'
html
<p>This is code!</p>
Andrew McCormick
17,730 Points<div id="somecode">
<h1> Mike the Frog </h1>
</div>
^^jackpot? I started the block with 3 ticks then an opening code and pre tag. Then after closing the div I just used three ticks on the next line without closing the code and pre tags.
I try to close those tags:
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
</pre></code>
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
lorem
is it really all about the blank line above the ticks?
No code or pre tags. just ticks making sure to leave a blank line above and below the ticks:
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
<div id="somecode">
<h1> Mike the Frog </h1>
</div>
trying with language tag:
<?php
function helloWorld() {
echo "Did I finally get this?";
}
helloWorld();
?>
BAM!
Andrew McCormick
17,730 Pointsok.. someone can delete this now :)

Patrick Donahue
9,523 PointsYea the Markdown cheatsheet says use the back ticks on the lines before and after but in the example it has it on the same line.
Seems like someone should report an issue!
Andrew McCormick
17,730 Pointsyes. I also realized that I have to put an entire blank line above and below the line with the ticks to make it work. what finally worked for me every time was this (obviously this is spelled out with extra blank lines to force new line, and not exactly what is entered): ---This would be blank line---
---this would be line with 3 ticks ---
---this would be code / code block ---
---line with 3 ticks---
---another completely blank line---