Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-83156: Add dedicated anchor for regexp syntax elements#17470

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
bmispelon wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
frombmispelon:regex-syntax-anchors

Conversation

bmispelon
Copy link
Contributor

@bmispelonbmispelon commentedDec 4, 2019
edited by AlexWaygood
Loading

@the-knights-who-say-ni

This comment was marked as resolved.

Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I rebased this and build the docs:

cd Docmake clean venv html

And it does add anchors likesyntax-dollar which you can visit by going tore.html#syntax-dollar:

image

But there's no hyperlink to click on and it's not obvious unless you know they exist or inspect the source. Should they be made more obvious?

@JelleZijlstra
Copy link
Member

Thanks for your PR, and sorry it has been open for so long!

I think these anchors are useful, but agree with@hugovk that it's hard to discover them with no available to click on. Is it possible to add that?

@bmispelon
Copy link
ContributorAuthor

Is it possible to add that?

Thanks for getting back to the PR eventually. I will look into how to add the pillcrow to the links.

JelleZijlstra reacted with thumbs up emoji

@bmispelon
Copy link
ContributorAuthor

I added a new commit that turns all the headings into<h3> which automatically gives them a nice ¶ on hover.

It does change the look of the page a little bit but I don't think it's for the worse personally. Here's the before/after on my machine:

Before:
Screenshot 2022-05-11 at 20-48-53 re — Regular expression operations — Python 3 12 0a0 documentation

After:
Screenshot 2022-05-11 at 20-47-44 re — Regular expression operations — Python 3 12 0a0 documentation

I also took the opportunity to add an..index reference to the new(?>...) syntax which seemed to be missing, I hope that's ok.

@hugovk
Copy link
Member

Also a long list in the menu on the left.

Before:

image

After:

image

@AlexWaygoodAlexWaygood changed the titlebpo-38975: Add dedicated anchor for regexp syntax elementsgh-83156: Add dedicated anchor for regexp syntax elementsOct 30, 2022
@CAM-Gerlach
Copy link
Member

Adding:name: s to theindex directives will generate a stable cross-reference target label that can be referenced internally or via Intersphinx with the:ref: role, as well as externally by copying the URL in the index, or manually grabbing theid of the anchorspan inspecting the HTML. This means that anyone referencing this in Sphinx documentation, or with a bit of HTML-fu, can reference each term, and they will also be searchable with Sphinx 5.2.0+ due tosphinx-doc/sphinx#10819 .

However, if we do want easily-clickable and copyable external links with the fragment id in the rendered document, section headings would need to be added. I'm not sure a way around them also being in the ToC without hacks or pushing them down 2+ heading levels, but maybe@AA-Turner knows a way? This hopefully won't be an issue in the future, though, as if we adopt a Sphinx theme like Lutra that separates the inter- and intra-document ToC into left and right sidebars, and for which we can limit the ToC depth of the latter to 2, we could avoid displaying them by only adding one layer of higher level sections (which seems quite appropriate to the current document content) and limiting page ToCs to displaying only up to h3 heading levels.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@hugovkhugovkhugovk left review comments

Assignees
No one assigned
Labels
awaiting changesdocsDocumentation in the Doc dirskip newstopic-regex
Projects
Status: Todo
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

9 participants
@bmispelon@the-knights-who-say-ni@JelleZijlstra@hugovk@CAM-Gerlach@willingc@ezio-melotti@bedevere-bot@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp