What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Usually I use spaces to format code. But make in particular requires tabs in some parts of makefiles. How can I enter a tab in markdown such actual tabs are printed in the code section of my answer?

share|improve this question
    
Why is this necessary? Why can't you just use spaces? –  Cody Gray Apr 2 '13 at 23:53
3  
@CodyGray: make explicitly requires tabs. See this answer for an explanation. –  Dan Apr 2 '13 at 23:56
    
Okay, I'm not debating that. I don't understand why code needs to be 100% copy-pastable. Make users know that it requires tabs. –  Cody Gray Apr 3 '13 at 4:08
    
@CodyGray: A makefile with spaces is a pretty subtle bug. I've been bitten by it before, and while I did include a warning I think it would be better to have both the warning and correct code. –  Dan Apr 3 '13 at 6:19

1 Answer 1

up vote 2 down vote accepted

It's not a very elegant solution (you lose syntax highlighting), but you can use a <pre> block and the HTML character entity &#9; for this.

E.g, the following:

<pre>
clean:
&#9;-rm -f $(EXE) $(EXE).a *.o
</pre>

renders as:

clean:
	-rm -f $(EXE) $(EXE).a *.o
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .