0

I usually post Mathematica code on SO. I saw the syntax highlighter started recognizing Mathematica syntax some time ago, but inconsistently. Really don't know if this is a bug, and if the SO crew can do something about it. Anyway:

When I am posting code, I see it renders OK:


enter image description here


However, after saving edits, I see:


enter image description here


Any ideas? Is this a bug? You can see this answer here.

1 Answer 1

1

Apparently the and tags have no language associated with them so you see no highlighting (not even on questions tagged mathematica alone). The highlighting you see in the editor doesn't always reflect what you will see in the final view. The editor and what you saw elsewhere probably was using the default highlighting scheme at the time (though oddly, I do not see it if I view your answer through the editor).

If you want to ensure that it has its highlighting, use some language hints for your code (perhaps lang-default). That way, despite not having a language chosen from the tags, your answer will still contain highlighting.

Do note however that if you do this, you might not see the highlighting if used on multiple blocks (at least, it doesn't seem to be fixed yet).

2
  • To see the highlighting you have to modify some code, only then it shows up. Commented Apr 19, 2011 at 18:34
  • @Wether: Ah I see it now. Even shows updated looking at the HTML source. I guess that's the pretty printer language detector at work determining what sort of language to use and chose lang-default. Commented Apr 19, 2011 at 18:37

You must log in to answer this question.

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