Skip to content

DOC add dropdown header permalink - #26872

Closed
greyisbetter wants to merge 6 commits into
scikit-learn:mainfrom
greyisbetter:header-permalink
Closed

greyisbetter wants to merge 6 commits into
scikit-learn:mainfrom
greyisbetter:header-permalink

Conversation

@greyisbetter

@greyisbetter greyisbetter commented Jul 20, 2023 •

Copy link
Copy Markdown
Contributor

as discussed in #26617

  • It will inject an id="xxx" in the <details> tag
  • if url have .html#xxx then it will add open to <details id="xxx"> tag

example:

it will change from:

<details>
  <summary class="btn btn-light">
    <strong>Custom Kernels</strong>

to:

<details id="custom-kernels" open>
  <summary class="btn btn-light">
    <strong>Custom Kernels<a class="headerlink" href="#custom-kernels" title="Custom Kernels">¶</a></strong>  

result:

dropdown result

cc @lucyleeow
cc @glemaitre @GaelVaroquaux

@github-actions

github-actions Bot commented Jul 20, 2023 •

Copy link
Copy Markdown

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: b8e7448. Link to the linter CI: here

@lucyleeow

lucyleeow commented Jul 21, 2023 •

Copy link
Copy Markdown
Member

Would it be possible to enable getting a link to a the header via clicking next to it, e.g.: (you can't see the mouse in the screenshot but it's next to the header)

image

I am not very familiar with javascript, potentially @glemaitre or @thomasjpfan would have better guidance on the best approach? Potentially there is a Sphinx way to do this as suggested in: #26617 (comment) ?

@greyisbetter

Copy link
Copy Markdown
Contributor Author

No it will not add that permalink icon to header but you go that section via https://scikit-learn.org/stable/modules/svm.html#custom-kernels

@lucyleeow

lucyleeow commented Jul 21, 2023 •

Copy link
Copy Markdown
Member

It's not so much the icon, but clicking on it will update the URL to append '#<section_name>', so you don't have to manually do this.

@greyisbetter

Copy link
Copy Markdown
Contributor Author

It's not so much the icon, but clicking on it will update the URL to append '#<section_name>', so you don't have to manually do this.

Now it will work as expected

@greyisbetter
greyisbetter deleted the header-permalink branch August 8, 2023 20:07
@lucyleeow

Copy link
Copy Markdown
Member

Sorry I know this is closed now but would this be an acceptable solution to being able to easily get hyperlinks to headers where a dropdown has been added? Maybe @glemaitre @thomasjpfan ?

@glemaitre

Copy link
Copy Markdown
Member

@lucyleeow I'm still in favor of having the feature that you requested. I did not get time to review PR lately but I should be back to business soonish.

If we can find an alternative solution to javascript, it would be better.

@glemaitre

Copy link
Copy Markdown
Member

@lucyleeow Would you mind opening a proper issue to be sure that we track properly this feature request?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants