-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Docs: Don't wrap the markdown for GitHub releases #6621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Don't wrap the markdown for GitHub releases #6621
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hi @hugovk, I've tried with a more complex example and it looks good: import pypandoc
def convert_rst_to_md_before(text):
return pypandoc.convert_text(text, "md", format="rst")
def convert_rst_to_md_after(text):
return pypandoc.convert_text(text, "md", format="rst", extra_args=["--wrap=preserve"])
text = """
pytest 5.3.5 (2020-01-29)
=========================
Bug Fixes
---------
- `#6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4 causing an INTERNALERROR due to a wrong assertion.
- `#6517 <https://github.com/pytest-dev/pytest/issues/6517>`_: Fix regression in pytest 5.3.4
causing an INTERNALERROR due to a wrong assertion.
This also checks something else.
Also see this:
.. code-block:: python
def test():
pass
Another example.
"""
print("AFTER")
print(convert_rst_to_md_after(text))
"""
print("AFTER")
print(convert_rst_to_md_after(text))
Render: https://gist.github.com/nicoddemus/83a3ef2c6548f481a1d9fe7787be396c So thanks a lot for looking into this. 👍 |
@nicoddemus this was waiting for an update AFAICT. |
Sorry, I forgot to push that last change. I can do it tomorrow or it's a simple thing if you'd like to do it. Thanks! |
@hugovk doesn't matter that much/enough I guess. |
Ouch my bad! 🤦♂ Will open a new PR. |
Follow up to pytest-dev#6621 after premature merge
Done in #6624. |
Thanks for submitting a PR, your contribution is really appreciated!
Here is a quick checklist that should be present in PRs.
master
branch for bug fixes, documentation updates and trivial changes.features
branch for new features, improvements, and removals/deprecations.Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
[n/a?] Create a new changelog file in the
changelog
folder, with a name like<ISSUE NUMBER>.<TYPE>.rst
. See changelog/README.rst for details.Write sentences in the past or present tense, examples:
Also make sure to end the sentence with a
.
.Add yourself to
AUTHORS
in alphabetical order.What happens
Releases on GitHub look like this, with oddly-wrapped text (eg. https://github.com/pytest-dev/pytest/releases/tag/5.3.5):
In edit mode, it wraps like this, but of course a lot of that link markdown isn't visible to the end user, and GitHub is respecting the newlines here:
https://github.com/pytest-dev/pytest/releases/edit/5.3.5
Why
I understand
scripts/publish-gh-release-notes.py
is run to convert reStructuredText into Markdown, and post it in the GitHub release. It takes RST from the changelog:https://github.com/pytest-dev/pytest/blob/master/doc/en/changelog.rst#pytest-535-2020-01-29
Here there's no newlines, in the plain RST, nor the rendered output.
The conversion is made using pypandoc:
The fix
pypandoc.convert_text
doesn't have any explicit line wrapping arguments, but you can useextra_args
to pass to the underlying pandoc tool:https://pandoc.org/MANUAL.html
And so:
Demo
I've not tested this using
scripts/publish-gh-release-notes.py
and I don't think there's tests for these helper scripts, so here's a short demo:Output:
A preview of this unwrapped text: