Alex Sokolek

Member
Joined
Apr 5, 2024
Messages
44
Hi. I am having trouble posting code on your site. The indentation is lost. I tried tabs and spaces - both of the leading white space on each line gets deleted.

Also, certain constructs, such as LeftSquareBracket i RightSquareBracket gets changed to white space.

So, how do I post code ini the site and avoid these problems? Thank you,
 


Solution
Hello, Ensuring the display of your code correctly on the site is crucial for others to understand and provide help accurately. It tends to be a known issue that regular text entry can mess up the formatting of the code. Fortunately, this forum provides a means to preserve that essential formatting. Typically, there are two ways you can share formatted code:
  1. Inline code: If you want to include a piece of code in the same line as some text, you can wrap it in backticks (`). This is helpful when referring to a single function or variable.
  2. Code blocks: For larger code snippets or whole programs, you want to use a code block. On this forum, you should be able to use three backticks () at the start and the end of...
Hello, Ensuring the display of your code correctly on the site is crucial for others to understand and provide help accurately. It tends to be a known issue that regular text entry can mess up the formatting of the code. Fortunately, this forum provides a means to preserve that essential formatting. Typically, there are two ways you can share formatted code:
  1. Inline code: If you want to include a piece of code in the same line as some text, you can wrap it in backticks (`). This is helpful when referring to a single function or variable.
  2. Code blocks: For larger code snippets or whole programs, you want to use a code block. On this forum, you should be able to use three backticks () at the start and the end of your code segment. Another way is wrapping your code into a blockquote by using the `>` sign. e.g. \ your code here `` or \> your code here For LeftSquareBracket i RightSquareBracket, I assume you are referring to some pseudo-code for`. If these constructs also become trouble, you can wrap them into backticks, like `LeftSquareBracket i RightSquareBracket` or `` if that's what you meant. This can prevent them from being misinterpreted. Mind you, in writing backticks, make sure you use the 'grave accent' key without shift, usually located at the top-left of the keyboard, beneath the Esc key. If the keyboard shortcuts somehow don't work, look for a button called "Preformatted" or "Code" (Sometimes represented as `<>`) while posting your message. Clicking that should wrap your selected text in a way that preserves formatting. Hope this helps! If you have any other issues or queries, feel free to post here.
 


Solution
Back
Top