docs: polish search form

This commit is contained in:
ob-yalian
2026-03-26 16:08:29 +08:00
parent a77d3c78e8
commit b4e5346e52
4 changed files with 669 additions and 19 deletions
+157 -6
View File
@@ -6,7 +6,9 @@
const SEARCH_APP_ID = "section-search-app"; const SEARCH_APP_ID = "section-search-app";
const SEARCH_RESULTS_ID = "section-search-results"; const SEARCH_RESULTS_ID = "section-search-results";
const SEARCH_STATUS_ID = "section-search-status"; const SEARCH_STATUS_ID = "section-search-status";
const SEARCH_HISTORY_ID = "section-search-history";
const HIT_CLASS = "section-search-hit"; const HIT_CLASS = "section-search-hit";
const HISTORY_LIMIT = 8;
let searchIndexPromise = null; let searchIndexPromise = null;
@@ -26,11 +28,14 @@
const input = form ? form.querySelector('input[name="q"]') : null; const input = form ? form.querySelector('input[name="q"]') : null;
const resultsRoot = document.getElementById(SEARCH_RESULTS_ID); const resultsRoot = document.getElementById(SEARCH_RESULTS_ID);
const statusRoot = document.getElementById(SEARCH_STATUS_ID); const statusRoot = document.getElementById(SEARCH_STATUS_ID);
const historyRoot = document.getElementById(SEARCH_HISTORY_ID);
if (input) { if (input) {
input.value = query; input.value = query;
} }
initSearchHistory(app, form, input, historyRoot, query);
if (!query) { if (!query) {
if (statusRoot) { if (statusRoot) {
statusRoot.textContent = app.dataset.emptyQuery || ""; statusRoot.textContent = app.dataset.emptyQuery || "";
@@ -45,6 +50,8 @@
loadSearchIndex() loadSearchIndex()
.then((payload) => { .then((payload) => {
const results = searchEntries(payload.entries || [], query); const results = searchEntries(payload.entries || [], query);
saveSearchHistory(query);
renderSearchHistory(app, historyRoot, query, input ? input.value.trim() : "");
renderResults(resultsRoot, statusRoot, app, query, results); renderResults(resultsRoot, statusRoot, app, query, results);
}) })
.catch((error) => { .catch((error) => {
@@ -229,26 +236,118 @@
root.appendChild(list); root.appendChild(list);
} }
function initSearchHistory(app, form, input, historyRoot, query) {
if (!form || !input || !historyRoot) {
return;
}
renderSearchHistory(app, historyRoot, query, input.value.trim());
form.addEventListener("submit", () => {
saveSearchHistory(input.value);
});
input.addEventListener("focus", () => {
renderSearchHistory(app, historyRoot, query, input.value.trim());
toggleHistoryVisibility(historyRoot, true);
});
input.addEventListener("input", () => {
renderSearchHistory(app, historyRoot, query, input.value.trim());
toggleHistoryVisibility(historyRoot, true);
});
document.addEventListener("click", (event) => {
if (!historyRoot.contains(event.target) && !form.contains(event.target)) {
toggleHistoryVisibility(historyRoot, false);
}
});
}
function renderSearchHistory(app, historyRoot, currentQuery, draftQuery) {
if (!historyRoot) {
return;
}
const history = getSearchHistory();
const keyword = normalizeText(draftQuery || "");
const filtered = keyword
? history.filter((item) => normalizeText(item).includes(keyword))
: history.slice();
historyRoot.replaceChildren();
const header = document.createElement("div");
header.className = "section-search-history__header";
const title = document.createElement("div");
title.className = "section-search-history__title";
title.textContent = app.dataset.historyTitle || "Recent searches";
header.appendChild(title);
if (history.length) {
const clearButton = document.createElement("button");
clearButton.type = "button";
clearButton.className = "section-search-history__clear";
clearButton.textContent = app.dataset.clearHistory || "Clear history";
clearButton.addEventListener("click", () => {
clearSearchHistory();
renderSearchHistory(app, historyRoot, currentQuery, draftQuery);
toggleHistoryVisibility(historyRoot, true);
});
header.appendChild(clearButton);
}
historyRoot.appendChild(header);
const list = document.createElement("div");
list.className = "section-search-history__list";
if (!filtered.length) {
const empty = document.createElement("div");
empty.className = "section-search-history__empty";
empty.textContent = keyword ? app.dataset.noResults || "" : app.dataset.historyEmpty || "";
list.appendChild(empty);
} else {
filtered.forEach((item) => {
const link = document.createElement("a");
link.className = "section-search-history__item";
link.href = "?q=" + encodeURIComponent(item);
link.textContent = item;
if (normalizeText(item) === normalizeText(currentQuery)) {
link.setAttribute("aria-current", "true");
}
list.appendChild(link);
});
}
historyRoot.appendChild(list);
toggleHistoryVisibility(historyRoot, Boolean(history.length || keyword));
}
function renderResultItem(result, query, highlightTerms) { function renderResultItem(result, query, highlightTerms) {
const item = document.createElement("li"); const item = document.createElement("li");
item.className = "kind-text"; item.className = "kind-text section-search-result";
const header = document.createElement("div");
header.className = "section-search-result__header";
const link = document.createElement("a"); const link = document.createElement("a");
link.className = "section-search-result__title";
link.href = buildResultUrl(result.entry.url, query); link.href = buildResultUrl(result.entry.url, query);
appendHighlightedText(link, result.entry.title || result.entry.page_title || "", highlightTerms); appendHighlightedText(link, result.entry.title || result.entry.page_title || "", highlightTerms);
item.appendChild(link); header.appendChild(link);
item.appendChild(header);
if (result.entry.page_title && result.entry.page_title !== result.entry.title) { if (result.entry.page_title && result.entry.page_title !== result.entry.title) {
const context = document.createElement("span"); const context = document.createElement("div");
context.appendChild(document.createTextNode(" (")); context.className = "section-search-result__meta";
context.appendChild(createHighlightedFragment(result.entry.page_title, highlightTerms)); context.appendChild(createHighlightedFragment(result.entry.page_title, highlightTerms));
context.appendChild(document.createTextNode(")"));
item.appendChild(context); item.appendChild(context);
} }
if (result.snippet) { if (result.snippet) {
const summary = document.createElement("p"); const summary = document.createElement("p");
summary.className = "search-snippet"; summary.className = "search-snippet section-search-result__snippet";
summary.appendChild(createHighlightedFragment(result.snippet, highlightTerms)); summary.appendChild(createHighlightedFragment(result.snippet, highlightTerms));
item.appendChild(summary); item.appendChild(summary);
} }
@@ -400,10 +499,62 @@
return new URLSearchParams(window.location.search).get(name) || ""; return new URLSearchParams(window.location.search).get(name) || "";
} }
function getSearchHistory() {
try {
const raw = window.localStorage.getItem(getHistoryStorageKey());
const parsed = raw ? JSON.parse(raw) : [];
return Array.isArray(parsed)
? parsed.map((item) => collapseWhitespace(String(item))).filter(Boolean).slice(0, HISTORY_LIMIT)
: [];
} catch (error) {
return [];
}
}
function saveSearchHistory(query) {
const normalized = collapseWhitespace(query);
if (!normalized) {
return;
}
const history = getSearchHistory().filter((item) => item !== normalized);
history.unshift(normalized);
try {
window.localStorage.setItem(getHistoryStorageKey(), JSON.stringify(history.slice(0, HISTORY_LIMIT)));
} catch (error) {
console.warn("Failed to save search history.", error);
}
}
function clearSearchHistory() {
try {
window.localStorage.removeItem(getHistoryStorageKey());
} catch (error) {
console.warn("Failed to clear search history.", error);
}
}
function getHistoryStorageKey() {
const scope =
window.location.pathname.replace(/search\.html$/i, "").replace(/index\.html$/i, "") ||
getUrlRoot() ||
"default";
return "section_search_recent_queries::" + scope;
}
function getUrlRoot() { function getUrlRoot() {
return (window.DOCUMENTATION_OPTIONS && window.DOCUMENTATION_OPTIONS.URL_ROOT) || ""; return (window.DOCUMENTATION_OPTIONS && window.DOCUMENTATION_OPTIONS.URL_ROOT) || "";
} }
function toggleHistoryVisibility(historyRoot, visible) {
if (!historyRoot) {
return;
}
historyRoot.hidden = !visible;
}
function containsAny(text, terms) { function containsAny(text, terms) {
const normalized = text.toLowerCase(); const normalized = text.toLowerCase();
return terms.some((term) => normalized.includes(term.toLowerCase())); return terms.some((term) => normalized.includes(term.toLowerCase()));
+24 -13
View File
@@ -27,24 +27,35 @@
data-no-results="{{ '没有找到匹配结果。' if is_zh else 'No matching results found.' }}" data-no-results="{{ '没有找到匹配结果。' if is_zh else 'No matching results found.' }}"
data-result-one="{{ '找到 1 个匹配结果。' if is_zh else 'Found 1 matching result.' }}" data-result-one="{{ '找到 1 个匹配结果。' if is_zh else 'Found 1 matching result.' }}"
data-result-many="{{ '找到 {count} 个匹配结果。' if is_zh else 'Found {count} matching results.' }}" data-result-many="{{ '找到 {count} 个匹配结果。' if is_zh else 'Found {count} matching results.' }}"
data-history-title="{{ '最近搜索' if is_zh else 'Recent searches' }}"
data-history-empty="{{ '还没有搜索记录。' if is_zh else 'No recent searches yet.' }}"
data-clear-history="{{ '清空历史' if is_zh else 'Clear history' }}"
> >
<p> <p>
{{ '支持中文和英文搜索,结果会优先跳转到最接近的章节位置。' if is_zh else 'Supports both Chinese and English search and jumps to the closest matching section.' }} {{ '支持中文和英文搜索,结果会优先跳转到最接近的章节位置。' if is_zh else 'Supports both Chinese and English search and jumps to the closest matching section.' }}
</p> </p>
<form action="" method="get" role="search"> <div class="section-search-panel">
<input <form action="" method="get" role="search" class="section-search-form">
type="text" <div class="section-search-form__field">
name="q" <span class="section-search-form__icon" aria-hidden="true">⌕</span>
aria-labelledby="search-documentation" <input
value="" type="text"
autocomplete="off" name="q"
autocorrect="off" aria-labelledby="search-documentation"
autocapitalize="off" value=""
spellcheck="false" placeholder="{{ '输入关键词,例如:相机、sync_mode、网络相机' if is_zh else 'Search keywords like camera, sync_mode, network camera' }}"
/> autocomplete="off"
<input type="submit" value="{{ _('search') }}" /> autocorrect="off"
</form> autocapitalize="off"
spellcheck="false"
/>
</div>
<button type="submit" class="section-search-form__submit">{{ _('search') }}</button>
</form>
<div id="section-search-history" class="section-search-history" hidden></div>
</div>
<p id="section-search-status" class="search-summary"></p> <p id="section-search-status" class="search-summary"></p>
<div id="section-search-results"></div> <div id="section-search-results"></div>
+244
View File
@@ -156,6 +156,231 @@
padding: 0 0.12em !important; padding: 0 0.12em !important;
} }
.wy-nav-content .rst-content .section-search-panel {
margin: 1.35rem 0 1rem !important;
}
.wy-nav-content .rst-content .section-search-form {
display: flex !important;
align-items: stretch !important;
gap: 0.85rem !important;
margin-bottom: 0.75rem !important;
}
.wy-nav-content .rst-content .section-search-form__field {
display: flex !important;
align-items: center !important;
flex: 1 1 auto !important;
min-height: 3.15rem !important;
padding: 0 1rem !important;
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
border: 1px solid #d0d7de !important;
border-radius: 16px !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 20px rgba(31, 35, 40, 0.06) !important;
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-form__field:focus-within {
border-color: #0969da !important;
box-shadow: 0 0 0 4px rgba(9, 105, 218, 0.12), 0 12px 28px rgba(31, 35, 40, 0.1) !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-form__icon {
flex: 0 0 auto !important;
margin-right: 0.7rem !important;
color: #57606a !important;
font-size: 1.15rem !important;
line-height: 1 !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"] {
flex: 1 1 auto !important;
width: 100% !important;
min-width: 0 !important;
padding: 0 !important;
border: 0 !important;
background: transparent !important;
color: #1f2328 !important;
font-size: 1rem !important;
line-height: 1.5 !important;
box-shadow: none !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"]::placeholder {
color: #8c959f !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"]:focus {
outline: none !important;
}
.wy-nav-content .rst-content .section-search-form__submit {
flex: 0 0 auto !important;
min-width: 7rem !important;
padding: 0 1.35rem !important;
border: 0 !important;
border-radius: 16px !important;
background: linear-gradient(135deg, #0969da 0%, #1f6feb 100%) !important;
color: #ffffff !important;
font-size: 0.98rem !important;
font-weight: 700 !important;
letter-spacing: 0.01em !important;
box-shadow: 0 12px 28px rgba(9, 105, 218, 0.22) !important;
cursor: pointer !important;
transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-form__submit:hover {
transform: translateY(-1px) !important;
box-shadow: 0 16px 32px rgba(9, 105, 218, 0.28) !important;
filter: brightness(1.02) !important;
}
.wy-nav-content .rst-content .section-search-form__submit:focus {
outline: 3px solid rgba(9, 105, 218, 0.18) !important;
outline-offset: 2px !important;
}
.wy-nav-content .rst-content .section-search-history {
margin-bottom: 0.8rem !important;
padding: 0.9rem 1rem 1rem !important;
background: #ffffff !important;
border: 1px solid #d8dee4 !important;
border-radius: 16px !important;
box-shadow: 0 10px 24px rgba(31, 35, 40, 0.08) !important;
}
.wy-nav-content .rst-content .section-search-history__header {
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
gap: 0.75rem !important;
margin-bottom: 0.8rem !important;
}
.wy-nav-content .rst-content .section-search-history__title {
color: #57606a !important;
font-size: 0.9rem !important;
font-weight: 700 !important;
letter-spacing: 0.01em !important;
text-transform: uppercase !important;
}
.wy-nav-content .rst-content .section-search-history__clear {
padding: 0 !important;
border: 0 !important;
background: transparent !important;
color: #0969da !important;
font-size: 0.92rem !important;
font-weight: 600 !important;
cursor: pointer !important;
}
.wy-nav-content .rst-content .section-search-history__clear:hover {
color: #0550ae !important;
text-decoration: underline !important;
}
.wy-nav-content .rst-content .section-search-history__list {
display: flex !important;
flex-wrap: wrap !important;
gap: 0.65rem !important;
}
.wy-nav-content .rst-content .section-search-history__item,
.wy-nav-content .rst-content .section-search-history__empty {
display: inline-flex !important;
align-items: center !important;
min-height: 2.2rem !important;
padding: 0.4rem 0.8rem !important;
border-radius: 999px !important;
font-size: 0.95rem !important;
line-height: 1.3 !important;
}
.wy-nav-content .rst-content .section-search-history__item {
color: #1f2328 !important;
background: #f6f8fa !important;
border: 1px solid #d0d7de !important;
text-decoration: none !important;
transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-history__item:hover {
color: #0550ae !important;
background: #edf4ff !important;
border-color: #9ec1ff !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-history__item[aria-current="true"] {
color: #0550ae !important;
background: #eaf2ff !important;
border-color: #7aa7ff !important;
font-weight: 700 !important;
}
.wy-nav-content .rst-content .section-search-history__empty {
color: #57606a !important;
background: #f6f8fa !important;
border: 1px dashed #d0d7de !important;
}
.wy-nav-content .rst-content #section-search-results .search {
list-style: none !important;
padding-left: 0 !important;
margin: 1.2rem 0 0 !important;
display: grid !important;
gap: 0.95rem !important;
}
.wy-nav-content .rst-content #section-search-results .search li.section-search-result {
margin: 0 !important;
padding: 1rem 1.1rem 1.05rem !important;
background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
border: 1px solid #d8dee4 !important;
border-radius: 14px !important;
box-shadow: 0 1px 2px rgba(31, 35, 40, 0.06) !important;
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content #section-search-results .search li.section-search-result:hover {
border-color: #b6c2cf !important;
box-shadow: 0 10px 24px rgba(31, 35, 40, 0.08) !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-result__header {
margin-bottom: 0.35rem !important;
}
.wy-nav-content .rst-content .section-search-result__title {
display: block !important;
font-size: 1.08rem !important;
font-weight: 700 !important;
line-height: 1.45 !important;
text-decoration: none !important;
}
.wy-nav-content .rst-content .section-search-result__meta {
display: inline-block !important;
margin-bottom: 0.6rem !important;
padding: 0.18rem 0.55rem !important;
font-size: 0.86rem !important;
line-height: 1.4 !important;
color: #57606a !important;
background: #f6f8fa !important;
border: 1px solid #d8dee4 !important;
border-radius: 999px !important;
}
.wy-nav-content .rst-content .section-search-result__snippet {
margin: 0 !important;
color: #24292f !important;
line-height: 1.7 !important;
}
.wy-nav-content .rst-content code, .wy-nav-content .rst-content code,
.wy-nav-content .rst-content tt, .wy-nav-content .rst-content tt,
.wy-nav-content .rst-content .literal { .wy-nav-content .rst-content .literal {
@@ -351,4 +576,23 @@
.wy-nav-content .rst-content h2 { .wy-nav-content .rst-content h2 {
font-size: 1.45rem !important; font-size: 1.45rem !important;
} }
.wy-nav-content .rst-content .section-search-form {
flex-direction: column !important;
gap: 0.7rem !important;
}
.wy-nav-content .rst-content .section-search-form__submit {
width: 100% !important;
min-height: 3rem !important;
}
.wy-nav-content .rst-content .section-search-history {
padding: 0.85rem 0.85rem 0.9rem !important;
}
.wy-nav-content .rst-content .section-search-history__header {
align-items: flex-start !important;
flex-direction: column !important;
}
} }
+244
View File
@@ -156,6 +156,231 @@
padding: 0 0.12em !important; padding: 0 0.12em !important;
} }
.wy-nav-content .rst-content .section-search-panel {
margin: 1.35rem 0 1rem !important;
}
.wy-nav-content .rst-content .section-search-form {
display: flex !important;
align-items: stretch !important;
gap: 0.85rem !important;
margin-bottom: 0.75rem !important;
}
.wy-nav-content .rst-content .section-search-form__field {
display: flex !important;
align-items: center !important;
flex: 1 1 auto !important;
min-height: 3.15rem !important;
padding: 0 1rem !important;
background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
border: 1px solid #d0d7de !important;
border-radius: 16px !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 20px rgba(31, 35, 40, 0.06) !important;
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-form__field:focus-within {
border-color: #0969da !important;
box-shadow: 0 0 0 4px rgba(9, 105, 218, 0.12), 0 12px 28px rgba(31, 35, 40, 0.1) !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-form__icon {
flex: 0 0 auto !important;
margin-right: 0.7rem !important;
color: #57606a !important;
font-size: 1.15rem !important;
line-height: 1 !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"] {
flex: 1 1 auto !important;
width: 100% !important;
min-width: 0 !important;
padding: 0 !important;
border: 0 !important;
background: transparent !important;
color: #1f2328 !important;
font-size: 1rem !important;
line-height: 1.5 !important;
box-shadow: none !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"]::placeholder {
color: #8c959f !important;
}
.wy-nav-content .rst-content .section-search-form input[name="q"]:focus {
outline: none !important;
}
.wy-nav-content .rst-content .section-search-form__submit {
flex: 0 0 auto !important;
min-width: 7rem !important;
padding: 0 1.35rem !important;
border: 0 !important;
border-radius: 16px !important;
background: linear-gradient(135deg, #0969da 0%, #1f6feb 100%) !important;
color: #ffffff !important;
font-size: 0.98rem !important;
font-weight: 700 !important;
letter-spacing: 0.01em !important;
box-shadow: 0 12px 28px rgba(9, 105, 218, 0.22) !important;
cursor: pointer !important;
transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-form__submit:hover {
transform: translateY(-1px) !important;
box-shadow: 0 16px 32px rgba(9, 105, 218, 0.28) !important;
filter: brightness(1.02) !important;
}
.wy-nav-content .rst-content .section-search-form__submit:focus {
outline: 3px solid rgba(9, 105, 218, 0.18) !important;
outline-offset: 2px !important;
}
.wy-nav-content .rst-content .section-search-history {
margin-bottom: 0.8rem !important;
padding: 0.9rem 1rem 1rem !important;
background: #ffffff !important;
border: 1px solid #d8dee4 !important;
border-radius: 16px !important;
box-shadow: 0 10px 24px rgba(31, 35, 40, 0.08) !important;
}
.wy-nav-content .rst-content .section-search-history__header {
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
gap: 0.75rem !important;
margin-bottom: 0.8rem !important;
}
.wy-nav-content .rst-content .section-search-history__title {
color: #57606a !important;
font-size: 0.9rem !important;
font-weight: 700 !important;
letter-spacing: 0.01em !important;
text-transform: uppercase !important;
}
.wy-nav-content .rst-content .section-search-history__clear {
padding: 0 !important;
border: 0 !important;
background: transparent !important;
color: #0969da !important;
font-size: 0.92rem !important;
font-weight: 600 !important;
cursor: pointer !important;
}
.wy-nav-content .rst-content .section-search-history__clear:hover {
color: #0550ae !important;
text-decoration: underline !important;
}
.wy-nav-content .rst-content .section-search-history__list {
display: flex !important;
flex-wrap: wrap !important;
gap: 0.65rem !important;
}
.wy-nav-content .rst-content .section-search-history__item,
.wy-nav-content .rst-content .section-search-history__empty {
display: inline-flex !important;
align-items: center !important;
min-height: 2.2rem !important;
padding: 0.4rem 0.8rem !important;
border-radius: 999px !important;
font-size: 0.95rem !important;
line-height: 1.3 !important;
}
.wy-nav-content .rst-content .section-search-history__item {
color: #1f2328 !important;
background: #f6f8fa !important;
border: 1px solid #d0d7de !important;
text-decoration: none !important;
transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content .section-search-history__item:hover {
color: #0550ae !important;
background: #edf4ff !important;
border-color: #9ec1ff !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-history__item[aria-current="true"] {
color: #0550ae !important;
background: #eaf2ff !important;
border-color: #7aa7ff !important;
font-weight: 700 !important;
}
.wy-nav-content .rst-content .section-search-history__empty {
color: #57606a !important;
background: #f6f8fa !important;
border: 1px dashed #d0d7de !important;
}
.wy-nav-content .rst-content #section-search-results .search {
list-style: none !important;
padding-left: 0 !important;
margin: 1.2rem 0 0 !important;
display: grid !important;
gap: 0.95rem !important;
}
.wy-nav-content .rst-content #section-search-results .search li.section-search-result {
margin: 0 !important;
padding: 1rem 1.1rem 1.05rem !important;
background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
border: 1px solid #d8dee4 !important;
border-radius: 14px !important;
box-shadow: 0 1px 2px rgba(31, 35, 40, 0.06) !important;
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease !important;
}
.wy-nav-content .rst-content #section-search-results .search li.section-search-result:hover {
border-color: #b6c2cf !important;
box-shadow: 0 10px 24px rgba(31, 35, 40, 0.08) !important;
transform: translateY(-1px) !important;
}
.wy-nav-content .rst-content .section-search-result__header {
margin-bottom: 0.35rem !important;
}
.wy-nav-content .rst-content .section-search-result__title {
display: block !important;
font-size: 1.08rem !important;
font-weight: 700 !important;
line-height: 1.45 !important;
text-decoration: none !important;
}
.wy-nav-content .rst-content .section-search-result__meta {
display: inline-block !important;
margin-bottom: 0.6rem !important;
padding: 0.18rem 0.55rem !important;
font-size: 0.86rem !important;
line-height: 1.4 !important;
color: #57606a !important;
background: #f6f8fa !important;
border: 1px solid #d8dee4 !important;
border-radius: 999px !important;
}
.wy-nav-content .rst-content .section-search-result__snippet {
margin: 0 !important;
color: #24292f !important;
line-height: 1.7 !important;
}
.wy-nav-content .rst-content code, .wy-nav-content .rst-content code,
.wy-nav-content .rst-content tt, .wy-nav-content .rst-content tt,
.wy-nav-content .rst-content .literal { .wy-nav-content .rst-content .literal {
@@ -351,4 +576,23 @@
.wy-nav-content .rst-content h2 { .wy-nav-content .rst-content h2 {
font-size: 1.45rem !important; font-size: 1.45rem !important;
} }
.wy-nav-content .rst-content .section-search-form {
flex-direction: column !important;
gap: 0.7rem !important;
}
.wy-nav-content .rst-content .section-search-form__submit {
width: 100% !important;
min-height: 3rem !important;
}
.wy-nav-content .rst-content .section-search-history {
padding: 0.85rem 0.85rem 0.9rem !important;
}
.wy-nav-content .rst-content .section-search-history__header {
align-items: flex-start !important;
flex-direction: column !important;
}
} }