Go Down

Topic: Arduino Code Syntax Highlighter for your WordPress blog (Read 2259 times) previous topic - next topic

ElectroNick

Hi guys, wanted to let anyone interested in sprucing up Arduino code posted on their blogs (WP based) know about the little plugin I wrote that makes the code listings appear in the colors and font theme of the Arduino IDE. 

Arduino Code Syntax Highlighter WordPress plugin is here

it's based on SyntaxHighlighter Evolved WordPress plugin and basically just makes for an easier reading of the code on blog pages, especially if you're explaining the code 'cause it numbers and highlights lines and makes the code look as if you're still in the IDE. See the link for examples, too.

Happy coding!

 /\_/\      ARDUINO
((@v@))     CNC
()~|~()

robtillaart

Thanks, looks very good!  (should be in the forum too ?)


Could the highlighter also take care of reindenting the code?  like the CTRL-T in the IDE?
would make it even more readable!

e.g. - http://elabz.com/arduino-nano-and-hp5082-7433-vintage-7-segment-led-display/-
at the end there is a "strange " indentation


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ElectroNick

Thanks, robtillaart!

As far as the Highlighter being in the forum (I think you meant arduino.cc/forum, right?) - I can't say I'm very familiar with the platform it runs on - Simple Machines - even though I worked on its precursor before. I'll definitely take a look at it and see what I can do. But, obviously, the decision to use it or not should be the administrators' and I'm not even so sure who they are and whom should I contact if such integration is successful.

As far as the WP plugin itself: I would have to admit, it would be much easier to run Ctl-T in Arduino IDE before  copying the code and pasting it into WordPress rather than having WP second-guess the formatting. In addition to this, it may be beneficial to leave the final formatting to the programmer: for example, I myself prefer to reset indentations (that is, move the text back to the beginning of the line) where I have several (4-5 or more) stacked indentations. Anyhow, I think it will be more flexible if the actual formatting of the text is done in the IDE.

Quote
a "strange " indentation
- do you mean, like on Line 112? Well, that's because until this morning I did not know Ctl-T command existed!  :smiley-red:  I guess I got a bit spoiled with auto-formatting on the fly in other editors I use, so I thought Aruino IDE is just not auto-formatting. Didn't look like a big deal to me either, but now I know I was wrong! I should have done Ctl-T before copy/pasting the code into the post.

Anyway, if I find a way to do it in SMF forum software, I'll post here and then admins will decide if it's something worth using.

 /\_/\      ARDUINO
((@v@))     CNC
()~|~()

robtillaart

Quote
I think you meant arduino.cc/forum, right?

yes,

Thanks sofar!
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up