Formatting code examples, error messages, etc

There exists a tip already on how to format snippets and error text in one’s post using apostrophes. This doesn’t really work well on WIN keyboard. The tip doesn’t tell you that the easy way is highlight the text to be formatted then click on the double quote on the tool line. So easy so neat :grinning:


ScruffR: Sample code block

// this is a C code block with code highlighting
int      x = 0;
String str = "this is a string";

yeah! success the character is found under the tilde on my keyboard.
Thanks for help (I'll bet i'm not the only who didn't/doesn't know a grave from an apostrophe).

void setup()
{
}
This is an anonymous text block without highlighting

below is my attempt use the advice

int i = 0; // counter

You’d not use the apostrophes (') but the grave accents (```).
These are usually composite characters that will be unified with the next following vowel into simething like “à”, but if you want to have them as single character, you’d either type a blank (which will end up in only printing the grave accent), or you type the next consonant like in (’’'cpp - here I used the apostrophes to show the otherwise interpreted grave accents).


I’ll edit your own post, so that you can look at it how it’s done (by “editing” it via the :pencil2: symbol)

2 Likes

Although it's much better than without that, we'd still very much prefer the correctly formatted version with the accent graves that will do the highlighting for you. Otherwise it will still be one big block of grey code.

1 Like