How to post logs and code in PlatformIO Community Forum

How to post logs and code in PlatformIO Community Forum

To make your protocol or source code easier to read, please use pre-formatted text (</> icon in the toolbar).

  1. Copy your source code or your protocol.

  2. Then click on the </> icon and paste your code.

Example: Content from a source code file

Without pre-formatted text:

void setup() {
Serial.begin(115200);
Serial.println(“Hello World!”);
}

void loop() {}

Using pre-formatted text:

void setup() {
  Serial.begin(115200);
  Serial.println("Hello World!");
}

void loop() {}

Example: error log

Without pre-formatted text:

src/main.cpp: In function ‘void setup()’:
src/main.cpp:3:5: error: ‘Serial’ was not declared in this scope
Serial.begin(115200);
^~~~~~
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1

Using pre-formatted text:

src/main.cpp: In function 'void setup()':
src/main.cpp:3:5: error: 'Serial' was not declared in this scope
     Serial.begin(115200);
     ^~~~~~
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1

Example: Content from a platformio.ini file

Without pre-formatted text:

[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev

Using pre-formatted text:

[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
3 Likes

Apart from being much more readable when formatted in this way, it prevents “strange” effects in the browser with:

  • Some text lines appearing in massive text for no reason.
  • The Windows backslash character, '\', in filenames, causes the following character to be treated as a control character or omitted from the text altogether.
  • Etc.

Cheers,
Norm.

I can’t find the </> symbol in the tool bar. Am I looking in the wrong place or do I need to install something additional?

It only shows up once you hit the “Reply” Button

Right next to the " symbol

You can also use the keyboard shortcut ctrl+e.