Formulas and code chunks

Recently I noticed a lot of hand written formulas or code which is just presented as plain text. Is there any possibility to implement Latex, like $\lambda$ and highlight code like we know from stackoverflow?

Cheers :slight_smile:

1 Like

Yes, this would be nice. I would support this too.

In summer we will get a new server. Probably we can consider this then. At least the code highlighting for Java and Python etc. Not sure if it will be possible for mathematical equations as it is in Latex.
What do you think @ramona_manda? Should be possible, no?

Hello all,
I have investigated and tested some formats options provided by discourse by default. If those are not enough, I am pretty sure we can find some free plugins.


var test = "aaa"

fence code (with triple thick) even makes syntax highlighting for some languages:


text  with preformatted text
and this text with 4 spaces before

this is what we can do using the ‘preformatted text’ button (or CTRL+Shift+C) or by adding 4 spaces in front of the line


other triple thick function with highlight
int a = 77;
this is fence code with triple thick (where it seems the syntax is not always working…)


Collapsable_content

another text to be collapsed


A few other nice formattting can be found here: https://superuser.com/editing-help

What do you think?

1 Like

Hi @ramona_manda,

I have just used the performated text option with 4 spaces, it looks much better…hence I posted python code, I tried to highlight the language but on a first try it does not work for me…but it is much better than plain text. Thanks alot :slight_smile:

Hmm, Python should work. I will investigate this and let you know. With great pleasure to help.

What would be the best method for writing mathematical formulas? For example * does not seem to work in many circumstances.

For special mathematical characters, the HTML codes from here can be used: https://websitebuilders.com/tools/html-codes/math/
2×5=10
For math formulas, I have not found yet a solution to work in discourse. I have tested HTML Math (http://www.w3.org/MarkUp/html3/maths.html) and MathML (http://www.w3.org/TR/MathML/) but none of them are working here.
Specifically for * (I suppose it is the multiplication operator), I am sometimes using the x letter to show the multiplication, but it is like a workaround:
c = a x b

For the moment, there is another (more elegant) workaround: to write the formula in specialized editors and export the image with the formula. For example, the following site offers this free functionality: https://www.codecogs.com/eqnedit.php
In my opinion, this is a good solution, so that we don’t rely on browsers to render the formulas as they can (sometimes, when using special characters or formatting, not all browsers render all the HTML elements in the same way).
I am still looking for a solution for complex math formulas and maybe even a plugin to add to the forum.