Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ fn item_module(cx: &Context<'_>, item: &clean::Item, items: &[clean::Item]) -> i
Some(ty::Visibility::Restricted(_)) => {
if myitem.is_doc_hidden() {
// Don't separate with a space when there are two of them
"<span title=\"Restricted Visibility\">&nbsp;🔒</span><span title=\"Hidden item\">👻</span> "
"<span class=\"priv-item\" title=\"Restricted Visibility\">&nbsp;🔒</span><span title=\"Hidden item\">👻</span> "
} else {
"<span title=\"Restricted Visibility\">&nbsp;🔒</span> "
"<span class=\"priv-item\" title=\"Restricted Visibility\">&nbsp;🔒</span> "
}
}
_ if myitem.is_doc_hidden() => {
Expand Down
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2891,6 +2891,11 @@ in src-script.js and main.js
margin-bottom: 0;
}

.hide-priv dt:has(.priv-item),
.hide-priv dt:has(.priv-item) + dd {
display: none;
}

/* End: styles for --scrape-examples feature */

/* Begin: styles for themes
Expand Down
20 changes: 20 additions & 0 deletions src/librustdoc/html/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
removeClass(document.documentElement, "word-wrap-source-code");
}
break;
case "show-private-items":
showPrivateItems(value === true);
}
}

Expand Down Expand Up @@ -286,6 +288,11 @@
"js_name": "word-wrap-source-code",
"default": false,
},
{
"name": "Show private items",
"js_name": "show-private-items",
"default": false,
},
];

// Then we build the DOM.
Expand Down Expand Up @@ -343,6 +350,19 @@
}
}

/**
* @param {boolean} value
*/
function showPrivateItems(value) {
/*document.querySelectorAll("dt:has([title='Restricted Visibility'])").forEach(x => x.hidden = !value);

Check failure on line 357 in src/librustdoc/html/static/js/settings.js

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

line longer than 100 chars
*/
if (value) {
removeClass(document.documentElement, "hide-priv");
} else {
addClass(document.documentElement, "hide-priv");
}
}

if (!isSettingsPage) {
// We replace the existing "onclick" callback.
// These elements must exist, as (outside of the settings page)
Expand Down
3 changes: 3 additions & 0 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ if (getSettingValue("sans-serif-fonts") === "true") {
if (getSettingValue("word-wrap-source-code") === "true") {
addClass(document.documentElement, "word-wrap-source-code");
}
if (getSettingValue("show-private-items") !== "true") {
addClass(document.documentElement, "hide-priv");
}
function updateSidebarWidth() {
const desktopSidebarWidth = getSettingValue("desktop-sidebar-width");
if (desktopSidebarWidth && desktopSidebarWidth !== "null") {
Expand Down
Loading