-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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] clarify the usage of versionadded
& co
#12412
Comments
I feel you are misunderstanding of how directives are parsed: .. restructuredtext-test-directive:: 3.14 It is
now3::
>>> ok
.. restructuredtext-test-directive:: 3.14 It is
now4::
>>> ok
.. restructuredtext-test-directive:: 3.14
It is now5::
>>> ok
.. restructuredtext-test-directive:: 3.14
It is now6::
>>> ok $ rst2pseudoxml test.rst --no-transforms
<document source="test.rst">
<system_message level="1" line="2" source="test.rst" type="INFO">
<paragraph>
Directive processed. Type="restructuredtext-test-directive", arguments=['3.14 It is\nnow3::'], options={}, content:
<literal_block xml:space="preserve">
>>> ok
<system_message level="1" line="7" source="test.rst" type="INFO">
<paragraph>
Directive processed. Type="restructuredtext-test-directive", arguments=['3.14 It is\nnow4::'], options={}, content:
<literal_block xml:space="preserve">
>>> ok
<system_message level="1" line="13" source="test.rst" type="INFO">
<paragraph>
Directive processed. Type="restructuredtext-test-directive", arguments=['3.14\nIt is now5::'], options={}, content:
<literal_block xml:space="preserve">
>>> ok
<system_message level="1" line="19" source="test.rst" type="INFO">
<paragraph>
Directive processed. Type="restructuredtext-test-directive", arguments=['3.14\nIt is now6::'], options={}, content:
<literal_block xml:space="preserve">
>>> ok |
Ah yes! it's an argument! I totally forgot about that for those directives (I think it's the only directive that does this kind of thing). Should we then perhaps say that The thing is, there isn't a "body" actually for those directives. We explicitly say
So... should we just clarify the doc? |
Wait.. now I'm confused, adding a blank line before seems to work (and does what I would have expected) but it's not correct according to the docs. |
versionadded
and versionchanged
bodies handle ::
differentlyversionadded
and versionchanged
Oh no, yeh I've just noticed, that it does not have a body it should just work like any other admonition, but has someone decided to "get clever" with only using an argument 🤷, .. versionchanged:: 3.11
The *repr()* of zero-valued flags has changed... |
Yes, but with the body... it works for me locally. And the HTML is consistent so I think we already did the change but we did not mention it on the docs? We haven't touched that code since 2018 roughly. |
ok yeh it does have a body, but that it parsed separately to the (optional) first paragraph: sphinx/sphinx/domains/changeset.py Line 67 in b90482f
But yeh, if you want to use a body, I feel we should definitely be telling people to use it as the body, rather than the same line as the version |
So... I'm not sure what should be supported but we seem to support the 2 args + body. The second argument is directly put after the version changed, whether you put that second argument on the same line as the version or on the next line (without a blankline), e.g.: .. versionchanged:: 3.14 SHORT_DESC
.. versionchanged:: 3.14
SHORT_DESC If you want a body (i.e., something that would be visually on the next line), you can put one but it will be aligned with the "Changed in version [...]" and not indented, e.g.: .. versionadded:: 3.14
ok
See::
1 + 1
and then gives you On the other hand, .. versionadded:: 3.14
okokok
See::
1 + 1
and then gives you EDIT: YOU CAN EVEN INSERT A NEW LINE AND IT WOULD BE TREATED NORMALLY: .. versionadded:: 3.14
It is now::
>>> 1 + 1
and then |
I don't know what to recommend now. I think it's just better to say "put whatever you want as a description as a body, whether it is a short description or not" but still, we should mention the alignment of the paragraph. |
yep 👍 |
versionadded
and versionchanged
versionadded
& co
versionadded
& coversionadded
& co
Describe the bug
Originally posted in python/cpython#120091 (comment)
I'm not really sure how to make it work but if it's too much work, let's just indicate the behaviour in the documentation of
.. versionadded
& co directives.How to Reproduce
produces
The text was updated successfully, but these errors were encountered: