We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Highlight your code. Press Ctrl+o
The forum software is meant for general purpose so posting code can be a bit tricky.
Start by properly indenting your code within the Processing editor using the Ctrl+t shortcut.
After pasting the code into the forum ensure it has blank lines before and after.
select the lines, and press Ctrl+o. (you can use the C button in the toolbar but select the lines first).
This will indent the lines with four spaces, which is the way to mark lines as code.
Review what you've posted.
You can edit posts using the 'Options' button at the top, the gear icon.
(There is advanced code formatting below)
This forum uses the Markdown formatting system, which is simpler to use than HTML, but can have annoying side effects when you are not careful (or aware of the rules)...
Look at the text area, where you type your message.
Below, a Markdown link shows a page summarizing the formatting rules. You can find other references on Internet.
Above the text area, a toolbar provides convenient shortcuts to the most commonly used commands. Select text and hit a button (or use the corresponding keyboard shortcut) to apply the command.
A preview button at the bottom allows you to see how your post will be formatted.
Look at your message after it has been posted, and if something went wrong, you can edit it and fix the problem.
Note that a subset of HTML is supported.
An important, not so intuitive rule of this Markdown flavor, is that line breaks are ignored, unless they are preceded by two spaces or followed by a blank line (another line break).
These make respectively a line break and a new paragraph.
The former is equivalent to HTML'
<br> tag, which can be used in place of the two spaces if you prefer.
The later corresponds to the
Note that you also need a blank line before and after a list or a code block (see below) otherwise their lines will be smashed together.
You can make unordered lists by writing several consecutive lines, each preceded by a dash and a space.
Like with code, you must have a blank line before the list.
You can number the list items by replacing the dash with a number and a dot (followed by a space, like above).
Alternatively, for a finer control, you can put the lines between the
</pre> tags. It allows to specify an attribute indicating the language to highlight:
You can also mark as code a fragment of text in a sentence (without line break), a code fragment, like
int v = int(1 + cos(a));, by selecting the code and using the same button or keyboard shortcut. It will surround the fragment with back-quotes ` characters.
Note: a common error is to hit the C button then to paste the code. It just messes up the code, because the behavior of the button changes depending if selection is made of several lines or just a text fragment.
You must first paste the text, select it, then hit the C button.
The formatter doesn't always do the right thing when highlighting code. Here are some caveats.
The forum tries to create an hyperlink to any posted URLs and you'll end up with HTML source in your code.
If the URL is within a comment then just remove the "http://"
If the URL is within code then split the protocol from the address:
"http://" + "example.com"
Multi-line comments should start with
/** rather than
/* or it will highlight the entire remaining code as a comment.
It treats at symbols as if they are referencing user accounts and will try and hyperlink them.
@Override should be posted as
The forum software tries to replace them with images. Just delete them.
[PhiLho original. Updated 2016-03-13 and made sticky again]
[Updated 2016-12-05. Fixed mac equivalent for Ctrl+o (it's Ctrl+o!). Added line about editing posts. Moved comments to top post.]