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

Is it possible to make brace match syntax highlighting in posts ?

When reading a post with long code blocks that have many loops and inner loops, it would be helpful to find where a particular block of code ends.

So that when we click on a starting brace, it would show the matching closing brace and vice-versa.

share|improve this question
1  
Alternatively: show us some examples of code blocks that are too long to decipher, and we'll downvote those posts? –  Arjan Jun 30 '12 at 22:19
2  
What I'd like is brace matching in the input editor. I'm constantly posting answers with missing parentheses. I know I could create them in Emacs and copy them, but for short code snippets I don't bother. –  Barmar Jan 6 at 11:33
1  
@Barmar I agree with that! –  Dan Mar 10 at 13:24

2 Answers 2

What about non brace using languages? How many levels should this nest? How should it handle incomplete marker pairs?

If code is unclear due to formatting, then it seems the proper thing to do would be to edit the post and improve the formatting and not rely on highlights that might be wrong due to errors in the original code.

share|improve this answer
5  
How should it handle incomplete marker pairs? - It should fail to compile with a suitably cryptic error message. –  Oded Jun 30 '12 at 20:16
4  
Like "brace yourself!"? –  Harald Brinkhof Jun 30 '12 at 20:25
    
"Space yourself" for python? –  Oded Jun 30 '12 at 20:26
3  
"What about non brace using languages?" -> don't highlight them. SO's highlighting is already language specific. –  Johannes Schaub - litb Jun 30 '12 at 20:39

Most IDE's match braces/parentheses/etc. Dreamweaver seems to do it, too, if you turn it on (on mobile now, will test it when I'm on my laptop later). Notepad++ matches braces as well.

So just copy-paste the code to an IDE, and use the brace-matching there.

If you don't have an IDE which does this, use the online editor on github. Edit a file of the same language (fork a repo with a file of the same language if you can't get one), the editor has syntax highlighting and brace matching. Actually, for brace matching you can edit a file in any programming language (except for the few languages that treat braces differently)--just that you won't get syntax highlighting.

share|improve this answer
2  
That's a lot of extra work for what is often just a couple of lines of code. –  Barmar May 12 '13 at 9:49

You must log in to answer this question.

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