This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How does one write code with syntax highlighting in the FEniCS Q&A forum?

+1 vote

I want to write code with syntax highlighting in this forum, but can't get it to work. Please advise.

asked Jun 6, 2013 by logg FEniCS Expert (11,790 points)

1 Answer

+2 votes
 
Best answer

At the moment, we have a Markdown Editor as the WYSIWYG editor.
This can perform all sorts of highlighting - see:
http://daringfireball.net/projects/markdown/syntax

In principal, you should be able to get highlighting by simply indenting 4 spaces,

if(True):
    print("Hello")

or

#include "rubbish.h"
R = new Rubbish;
answered Jun 6, 2013 by chris_richardson FEniCS Expert (31,740 points)
selected Jun 6, 2013 by logg
Excellent, thanks!
...