If you’ve had to document your code for a work report or school project, you must have quickly come to the realization that MS Word as well as most other word processing software are not probably equipped to formatting your code.
From your tabs or spaces ( I’m a tabs guy by the way) being all distorted to no comprehensive color scheme available, what you end with is code that’s barely readable and doesn’t look clean at all.
If like me you have that attention to detail thingy, this should definitely bug you. The first time I encountered the inconvenience was 2 years ago. I was documenting my end of year project, an online music player on php and just couldn’t get my code into MS Office properly.
Yes, I know… I could just do screenshots but those are not responsive at all and my mentor, as well as other people might want to simply copy code snippets from by projects and having screenshots of it only will be a huge bummer.
Turning to google for a couple of minutes, I stumbled on ALEX GORBATCHEV‘s Syntax Highlighter. A nifty JavaScript tool that helps you generate highlighted code snippets for a couple of programming languages which you can copy into most word processing software like MS Word and retain the highlighting.
You can find a working demo here
As you can see, the code lines are even numbered! So you or your mentor can easily reference any bit of code in your report. If you do not need the numbering, after pasting the highlighted code in MS Word, you can highlight it and switch from list numbering to bullets in paragraph section.
Hope this helps someone 🙂