-
-
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
DOC: Format role and directive cross-references in ReST format #12986
base: master
Are you sure you want to change the base?
Conversation
91eb05d
to
6a82098
Compare
6a82098
to
37ec7b9
Compare
In the context of the tutorials and instructional text, I like this change - as described, it does help to link the description of a directive with the output/syntax. We use the Also, on a more technical note: I notice that a few domains override |
Configurability (use ReST / text only) is a bit difficult with roles. We could make so that we accept both
No strong opinion. Generally, if a parameter is sufficient, I'd go with not creating a zoo of subclasses (also subclasses don't scale with combination of features), but if it's preferred, one could create specific XRefRole subclasses for different types of cross-references. When going with the configurable-through-parameter-format variant, subclasses could be a bit cleaner. |
Ok, yep - after building that locally and inspecting the results (including pages where I was curious about the effect on screen readers for accessibility -- also given that this could potentially compound with #12943. However: it turns out that the markup for the literal blocks isn't announced at least by Slightly off-topic: I did find this sentence somewhat confusing when spoken, but that can probably be resolved by rephrasing it
Edit: attempt to clarify the description of screenreader behaviour re: literals |
To clarify: I should have said that they aren't announced. |
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.
This would have helped me while learning about some Sphinx/rST basics.
I'd suggest a second opinion about the choice between an attribute/subclassing for the implementation, because I'm fairly ambivalent about it (but do want to mention it, in case other people have maintenance-related opinions).
The importance of the decision also depends on whether we assume XRefRole class is public API, i.e. whether extensions derive from it. If not, we are able to easily refactor in the future when the need arises. |
I've given this a lot of thought in the past especially when posting at SO. There's a difference between an "official doc" like the Sphinx documentation and an informal post in some Q&A somewhere. While I generally write IMO the change shouldn't be done, as said it becomes repetitive, then verbose and also redundant - when you say: " It may be tempting to spread coding artifacts into natural language prose, but this particular mixture breaks what should be the natural flow of the text. It's its own kind of XY problem: "lets not write correct prose because users can't read the reST between the lines "... Let us be pragmatic, after an initial round of learning Sphinx a user can be expected to know the difference between a directive and a role. Any of the getting started guides explains it enough. So we might be aiming to be helpful towards users who haven't read anything or failed to understand even the most basic reST constructs - they'll have to try building the docs either way; and read the official docs attentively too! I don't think introducing this problem into the docs will lend any help in those cases. That's my rational for giving a -1.
But I'll make 1 more argument: If the PR is focused on adding this as a Sphinx feature instead of a change to the docs; I'll have to conservatively ask if this isn't going down the path of feature bloat? Is there a real need for this? Is there a real demand for this? If the PR took 500 hours would it be worth it? But what's more: Isn't this changing/expanding basic and plain reST syntax as we've known it for years? (A role is a role, a directive a directive, and a cross-reference is a cross-reference...) Does the added complexity of changing the basic expectations come with any payoff considering POLA? |
@electric-coder thanks for given your opinion. I hear your concerns, but disagree with a number of your arguments. In the end, the question is: Is syntactic markup (of roles and/or directives) a net benefit for the reader? yes / no / it depends (which may warrant global or per usage configuability) It is a weighted decision. The two central arguments are:
all other aspect are minor. As a precedence, we use syntactic markup in add_function_parentheses. There's one argument, though that I have to explicitly reject:
I strongly believe, we should not go towards a RTFM attitude. It's not user-friendly, and it doesn't work. From my experience, only very few developers go and learn Sphinx from the ground up. Documentation isn't their primary goal and they don't invest extra time into learning its concepts. They just fiddle through and possibly have learned from example that one can write |
Esteemed @timhoffm you are welcome sir!
So in a nutshell no. It could make sense to add a system-wide config (like |
Changing
If they don't know this, then they should not be using directives 🤷 |
@chrisjsewell I'm unclear on the implecation of your comment. Are you objecting the syntactic formatting of role and/or directive links, or the way it is implemented by making |
both 😅 |
Cross-references only consisted of the target name so far:
This PR formats the references as one would write the role / directive in ReST:
While the ReST formatting is a bit more noisy, using the actual ReST format helps to make the mental connection, in particular also for less experienced sphinx users, who may not have a clear idea what a directive is, but much more likely can connect tot the
.. directive::
notation, which they have seen or written.