You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a docstring is formatted using markdown, an extra space at the end means that the next line is not to be wrapped. (pydoc3 uses markdown). Unfortunately, black removes the extra space, which causes markdown renders to not do what they are supposed to.
Example code that gets miss rendered. Note: I am using a _ to denote a space at the end of the line.
Original
defboo():
"""Halloween. This is not supposed to be wrapped._ New text """
After running black:
defboo():
"""Halloween. This is not supposed to be wrapped. New text """
Expected:
defboo():
"""Halloween. This is not supposed to be wrapped._ New text """
Environment
Black's version: 22.8.0
OS and Python version: linux: 3.9.13
The text was updated successfully, but these errors were encountered:
cazador481
changed the title
Black removing extra lines in docstrings. Breaking markdown formatting
Black removing extra spaces in docstrings. Breaking markdown formatting
Oct 3, 2022
In fact CommonMark says that we can use a backslash instead of trailing spaces.
For those using Python-Markdown / MkDocs, it has been asked before: Python-Markdown/markdown#1157.
Suggested solution: use the pymdownx.escapeall extension, with the hardbreak option enabled:
When a docstring is formatted using markdown, an extra space at the end means that the next line is not to be wrapped. (pydoc3 uses markdown). Unfortunately, black removes the extra space, which causes markdown renders to not do what they are supposed to.
Example code that gets miss rendered. Note: I am using a
_
to denote a space at the end of the line.Original
After running black:
Expected:
Environment
The text was updated successfully, but these errors were encountered: