Forum: Source Code highlighting

Information on the latest releases
Post Reply
User avatar
Vassilis
Posts: 174
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Forum: Source Code highlighting

Post by Vassilis » Mon Apr 22, 2019 11:02 am

Is added Source Code highlight based on highlight.js. Normally, highlight.js supports Arduino code among other languages but it seems that adding [code=ino] makes it look better.

Examples: [code=ino] ... [/code] for including arduino code, [code=cpp] ... [/code] for including C or C++ code etc.

Testing highlight:

Code: Select all

// the setup function runs once when you press reset or power the board
#define LED_BUILTIN PC13

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
- EDIT -
Supported highlights: ino, arduino, armasm, avrasm, bash, css, cmake, cpp, makefile, markdown, lua
Tell me if you want me to add more languages.
-Vassilis Serasidis

User avatar
Rick Kimball
Posts: 71
Joined: Thu Mar 14, 2019 6:27 pm
Location: Eastern NC, US
OS: Linux
IDE: Arduino 1.8.9, vscode+make, eclipse, vi, emacs
Core: libmaple, STM official, fabooh, none
Board: Bluepill, Nucleos, Discovery
Contact:

Re: Forum: Source Code highlighting

Post by Rick Kimball » Mon Apr 22, 2019 3:14 pm

Very slick! This is becoming the best forum for embedded board coding I've joined.
-rick

User avatar
MoDu
Posts: 70
Joined: Tue Mar 05, 2019 1:56 pm
Location: Lisbon
OS: Windows
IDE: Visual Studio
Core: Roger's
Board: Maple mini

Re: Forum: Source Code highlighting

Post by MoDu » Mon Apr 22, 2019 4:26 pm

Amaze. Me gusta.

User avatar
Vassilis
Posts: 174
Joined: Wed Feb 27, 2019 5:09 pm
Answers: 2
Location: Thessaloniki, Greece
OS: Linux, Win10, MacOS
IDE: Arduino 1.8.9
Core: Roger, STM official
Board: Bluepill, Maple mini, STM32F4xx
Contact:

Re: Forum: Source Code highlighting

Post by Vassilis » Tue Apr 23, 2019 12:05 pm

The highlight.js has "automatic language detection" feature. This feature does not seem to work very well. So, I have changed the code a little bit. When you add a [code]...[/code] the default text formatting is selected (green colored text). To add a highlighted text you need to add the language manually.

For example: [code=ino] ... [/code] for including arduino code, [code=cpp] ... [/code] for including C or C++ code etc.
The currently language support list is described at the first post. Tell me if you want me to add more languages.
-Vassilis Serasidis

ag123
Posts: 210
Joined: Thu Mar 07, 2019 6:15 am
OS: linux
IDE: eclipse, arduino 1.8.5
Core: Roger's
Board: Maple mini, Bluepill

Re: Forum: Source Code highlighting

Post by ag123 » Fri Apr 26, 2019 2:35 pm

+5 nice ! :D

User avatar
zoomx
Posts: 52
Joined: Tue Mar 05, 2019 8:10 am
Location: Mt Etna - Italy
OS: Windows 7 & 10
IDE: 1.8.8
Core: Roger & STM official
Board: Bluepill, Maple mini

Re: Forum: Source Code highlighting

Post by zoomx » Mon Apr 29, 2019 10:20 am

Great!

gbulmer
Posts: 30
Joined: Thu Mar 14, 2019 6:43 am
Location: UK
OS: MacOS, Windows, Linux
IDE: Arduino, VS Code, vi+GCC, mbed, Eclipse, ...
Core: STM32F103, STM32F303
Board: Maple, Nucleo, DIY

Re: Forum: Source Code highlighting

Post by gbulmer » Tue Apr 30, 2019 9:11 pm

That highlighting looks really good.
Excellent job Vassilis :D
GB-)

Post Reply