Black: Handle Python code in docs (ReST, markdown etc)

Created on 2 Jun 2018  路  5Comments  路  Source: psf/black

It would be nice if black would also handle Python code blocks in documentation files (reStructuredText, markdown etc).

(via https://github.com/pytest-dev/pytest/issues/3525#issuecomment-394101163)

enhancement help wanted

Most helpful comment

All 5 comments

hah, I had the same idea: https://github.com/ambv/black/issues/292

Heh..
Your issue seems to be a bit broader, and would be possible probably already, given that you could extract code blocks, run black on them and then replace them (kind of an API usage).

What I had in mind would be that black could be just run on documentation files, and would handle all code blocks in there.

Let's wait for some feedback from maintainer(s).

Sounds interesting, it would require a lot more dependencies to be added to Black though to enable parsing Markdown, ReST, and so on. I'll leave this open as I am not opposed to the idea. However, there are more urgent things we need to implement/fix before we can think about this.

I'm going to take a stab at implementing this in a separate project, maybe at some point it could be merged back into core

Was this page helpful?
0 / 5 - 0 ratings

Related issues

underyx picture underyx  路  22Comments

lig picture lig  路  84Comments

devxpy picture devxpy  路  70Comments

Kristinita picture Kristinita  路  28Comments

odormond picture odormond  路  21Comments