I'm writing a technical document using google docs, and I want to put code snippets into it.
I thought this would be hard, before I discovered http://hilite.me/
This awesome, and awesomely simple, web app converts snippets of code into coloured HTML.
It can format a comprehensive range of languages and apply an equally impressive variety of styles.
Here's a snip of javascript, I just copied and pasted it straight in here, so it doesn't handle the overflow well, but you have to admit that its pretty cool for something that has a quick copy/paste/click/copy/paste workflow:
for (var i = 0; i < dataObj.eventData.children.length; i++) { if (dataObj.isProduction){ dataObj.eventData.children[2].outcome.coupling = "1"; } if (dataObj.eventData.children[i].outcome.coupling.length > 0) { outcomeData = dataObj.eventData.children[i].outcome; priceBoost[counter] = Object.create(priceBoostObject); priceBoost[counter].createPriceBoostHTML(outcomeData); priceBoost[counter].applyPriceBoost(outcomeData); priceBoost[counter].applyExtraCss(outcomeData); priceBoost[counter].initialiseAnimatedImages('animated-' + outcomeData.id, 'images/test.png', 'test.html'); priceBoost[counter].checkTextWidth(outcomeData.id); counter++; } }
Comments: