I’ve noticed that you can use python libdiff to output a side by side comparison of files with their differences. Is there an easy way to output just one file in python as html with line numbers?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
HtmlFormatterof Pygments supports alinenosoption to enable line numbers. Pygments also features syntax highlighting for many languages, if desired, and it takes care of escaping HTML meta-characters. (For the line numbers only Pygments might be overkill.)