Provide Line Numbers for Your Code Listings

Have you ever wanted to list your code on a website and automatically number each line? Sure, you can do it manually, but it’s painful to go back and re-number all those lines should you decide to change the code. Also, it’s difficult for your viewers to copy and paste your code without having to back out all those line numbers.

Well, you’ll be glad to know that it’s really easy to implement this automatic line numbering feature. All you need to do is encase your code in <pre> … </pre> tags, and then let JavaScript and CSS do its stuff!
Continue reading