Code indentation

Why is it that I don’t seem to manage to indent the code in this window. I’m using the pre-formatted text function. I tried using spaces and tabs but none seem to help - some even manage to add color. Are they linking the code from somewhere else?

do you want to format multiline source code here in the forum?
like this:

Multiline
Code
is awesome

???

Add an empty row before and after your code and use 4 spaces to activate code-formtting.

Your example just shows un-indented formatted text in my browser (?) I’ve seen nicely indented and colored code on this forum.
Do you mean I need to use 4 spaces as indentation everywhere in the code, and still use the ‘preformatted text’ function? Because that doesn’t seem to do much …

Use three backticks: `
Use them before and after your code block.

function() { var x = 123; }
3 Likes

You can read about if you search for markdown code-formatting (keep in mind to have a empty line before and after your codes)

If you wrap your code in single-` you get one line code with the grey background

this is a one liner

if you want this with multiline use 4-spaces (in every line + your own indention).

asdfasdfasdf
    asdfasdfasdf
        asdfas

and as @lehresman said there is another mardown syntax --> with 3-` where you need no 4-space idention

function hallo () {
    var test = 123;
}
2 Likes