Forums Arduino Syntax Highlighting

Viewing 0 reply threads
  • Author
    Posts
    • #301
      UniquePete
      Participant

      For some time now I’ve been creating the panels I use to present Arduino code by laboriously manually styling individual code elements.

      I’m clearly a bit slow on the uptake because it only just recently occurred to me that, given that this sort of thing is not at all uncommon, someone must have come up with an easier way of doing this. And indeed this is the case!

      There are some pretty sophisticated solutions out there, some that pretty much take the form of complete language parsers and offer a huge range of options. There were, however a couple that were a lot more basic, and as a consequence, very much easier to understand and hence modify to meet my immediate and relatively simple requirements.

      I am now using a version of one of these to style the more recent code panels that appear on this website—to the untrained eye, there will be no difference between the styling in the old, manually styled panels and the new ‘automated’ styling (they’re both intended to emulate the Arduino IDE syntax highlighting). For details on how to use this JavaScript script to style both Arduino IDE and HTML code, check out the page on code syntax highlighting.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.

02-05-2020