Skip to content
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

Change "Permalink to this headline" to use "heading" instead #10041

Closed
pradyunsg opened this issue Jan 1, 2022 · 8 comments
Closed

Change "Permalink to this headline" to use "heading" instead #10041

pradyunsg opened this issue Jan 1, 2022 · 8 comments
Labels
builder:html type:proposal a feature suggestion
Milestone

Comments

@pradyunsg
Copy link
Contributor

Describe the bug

Sphinx-generated tooltips for headings use "Headline" instead of "Heading".

Picking out of https://ell.stackexchange.com/questions/196585/headline-vs-heading-vs-header:

"Headline" is normally used when an article appears as one of a collection of articles, such as a newspaper. If the article is reprinted separately, the headline becomes the "title". While a headline can also be called a heading, the term "heading" is more often used for what goes at the top of a section or sub-section of an article. [snip]

In fact, I would avoid the word "headline" except in reference to a newspaper or some publication/text organized in a way very similar to a newspaper.

How to Reproduce

Build any Sphinx documentation, containing one or more headings (eg: https://pradyunsg.me/furo/kitchen-sink/demo/). When hovering over the Sphinx-injected "headerlink", notice that it says "Headline" instead of "Heading".

Expected behavior

Instead of:

  • Permalink to this headline

The tooltip should be:

  • Permalink to this heading

Your project

https://github.com/pradyunsg/furo

Screenshots

Screenshot 2022-01-01 at 17 20 09

OS

N/A

Python version

N/A

Sphinx version

4.x

Sphinx extensions

No response

Extra tools

No response

Additional context

The relevant chunk of code:

def depart_title(self, node: Element) -> None:
close_tag = self.context[-1]
if (self.config.html_permalinks and self.builder.add_permalinks and
node.parent.hasattr('ids') and node.parent['ids']):
# add permalink anchor
if close_tag.startswith('</h'):
self.add_permalink_ref(node.parent, _('Permalink to this headline'))
elif close_tag.startswith('</a></h'):
self.body.append('</a><a class="headerlink" href="#%s" ' %
node.parent['ids'][0] +
'title="%s">%s' % (
_('Permalink to this headline'),
self.config.html_permalinks_icon))

This will also need some update to the translated strings, which means that this will likely need to be a Sphinx 5.0+ change?

@pradyunsg pradyunsg changed the title Change "Permalink to this headline" to "Permalink to this heading" Change "Permalink to this headline" to use "heading" instead Jan 1, 2022
@pradyunsg
Copy link
Contributor Author

FWIW, "Link to this heading" would be a better name IMO -- even though it's a more "drastic" rephrasing. :)

@tk0miya
Copy link
Member

tk0miya commented Jan 1, 2022

+1; Reasonable. Could you make a PR, please? Then I'll merge this into the master branch.

Note: To keep the message translated, it would be better to change it in the major release.

@tk0miya tk0miya added builder:html type:proposal a feature suggestion and removed type:bug labels Jan 1, 2022
@tk0miya tk0miya added this to the 5.0.0 milestone Jan 1, 2022
@mgeier
Copy link
Contributor

mgeier commented Jan 1, 2022

FWIW, "Link to this heading" would be a better name IMO

I agree.

"permalink" has a quite specific meaning which I think cannot be guaranteed by Sphinx. In fact, in many cases (probably the majority of sites out there), the generated link will contain something like latest, which is definitely not a permalink!

@pradyunsg
Copy link
Contributor Author

+1; Reasonable. Could you make a PR, please? Then I'll merge this into the master branch.

Happy to! Is there any specific thing that I'd need to do other than modifying the two spots in the codebase that use this string (via _("Permalink to this headline"))? Specifically, do the translation files need updating? If so, how should I do that?

@tk0miya
Copy link
Member

tk0miya commented Jan 2, 2022

It's okay to change the strings only. All translations are managed at transifex.com. And strings on our codebase will be synchronized to transifex.com automatically by weekly batch (see https://github.com/sphinx-doc/sphinx/actions/workflows/transifex.yml)

@pradyunsg
Copy link
Contributor Author

It ended up being more than two spots, but, hey, this PR has been filed! :)

@pradyunsg
Copy link
Contributor Author

"permalink" has a quite specific meaning which I think cannot be guaranteed by Sphinx. In fact, in many cases (probably the majority of sites out there), the generated link will contain something like latest, which is definitely not a permalink!

This is a good point and I agree that this is not-great!

It is, however, a separate and broader concern compared to this issue (intentionally restricted to just "headline") -- so... I've filed #10049, which is where we can discuss replacing the "Permalink" word. :)

@tk0miya tk0miya closed this as completed Jan 2, 2022
@pradyunsg
Copy link
Contributor Author

pradyunsg commented Jan 2, 2022

Thanks @tk0miya for the quick response, review and merge! ^.^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:html type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

3 participants