hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.56k stars 290 forks source link

autopep8 on .rst documentation files #348

Open arthurzenika opened 6 years ago

arthurzenika commented 6 years ago

Thanks for autopep8, it really helps getting some code to a almost readable style when getting legacy code.

I'm currently working on documentation which is in restructured text (.rst), and part of that has been converted from latex with latex2rst, so a lot of fixing needs to be done. I am dreaming about doing autopep8 -i *.rst as I sometimes to with .py files.

Any chance of getting such a feature with autopep8 ? Do you know of any projects that could do this ? I'm going to ask https://github.com/myint/docformatter too if there is place for .rst transformation there...

myint commented 6 years ago

I've actually looked for a reStructuredText formatter in the past. I didn't find one. But if there is one, it seems like it wouldn't be too difficult to have it call autopep8 on the Python code blocks.