-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Docs: emojis in TOC captions, FontAwesome on external links in TOC (Diátaxis) #10039
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,17 +21,19 @@ $( document ).ready(function() { | |
|
||
// Uses a hash referencing a Sphinx label from the URL page#sphinx-label | ||
var hash = window.location.hash.substr(1); | ||
hash = hash.replace(/[^0-9a-z\-_]/gi, ''); | ||
// If the hash is inside a tab panel | ||
var tab_with_reference = $(".sphinx-tabs-panel #" + hash).parents(".sphinx-tabs-panel"); | ||
if (hash) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What changed in this file? Seems like it needs a comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The git diff is awful, it was just a matter of adding It's explained in line 22, the following code is pretty verbose:
|
||
hash = hash.replace(/[^0-9a-z\-_]/gi, ''); | ||
// If the hash is inside a tab panel | ||
var tab_with_reference = $(".sphinx-tabs-panel #" + hash).parents(".sphinx-tabs-panel"); | ||
|
||
if (tab_with_reference.length > 0) { | ||
// Use the panel's ID to guess the tab's ID | ||
var panel_id = tab_with_reference.first().attr("id"); | ||
var tab_id = panel_id.replace("panel-", "tab-"); | ||
// Invoke the tab buttons click() method to display it | ||
$("button#" + tab_id).click(); | ||
// Scroll the tab widget into view | ||
$('html, body').animate({ scrollTop: tab_with_reference.parents(".sphinx-tabs").first().offset().top}, 1000); | ||
if (tab_with_reference.length > 0) { | ||
// Use the panel's ID to guess the tab's ID | ||
var panel_id = tab_with_reference.first().attr("id"); | ||
var tab_id = panel_id.replace("panel-", "tab-"); | ||
// Invoke the tab buttons click() method to display it | ||
$("button#" + tab_id).click(); | ||
// Scroll the tab widget into view | ||
$('html, body').animate({ scrollTop: tab_with_reference.parents(".sphinx-tabs").first().offset().top}, 1000); | ||
} | ||
} | ||
}); |
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.
I'd argue for this on all external links, but baby steps :)
Though @humitos had a good point that it makes the link more visible, but I think it's good to be explicit here?
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.
The font-awesome icon is much more discreet so I think that it works better.
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.
I get a feeling that this will cause unintended side-effects.. like if the
<a>
is on an<img>
tagThere 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.
Yea, we likely need to scope it smartly. I'm sure there's good examples of doing this other places, but we can start w/ the toctree for now.