diff options
author | 2022-07-25 21:08:53 +0000 | |
---|---|---|
committer | 2022-07-25 21:08:53 +0000 | |
commit | 451a231000edd1eab7a9ec23853e4d4dc0bef7e8 (patch) | |
tree | 23a6f780def09087bc1117e7ea6fdf011a391ffd /_static | |
parent | Deploying to docs from @ python-discord/bot-core@94c4b408f1afa604ae6907aa28ab... (diff) |
Deploying to docs from @ python-discord/bot-core@1f309b695e21511173ced9c729f4b78fa9839d73 🚀
Diffstat (limited to '_static')
-rw-r--r-- | _static/basic.css | 30 | ||||
-rw-r--r-- | _static/documentation_options.js | 2 | ||||
-rw-r--r-- | _static/searchtools.js | 17 |
3 files changed, 9 insertions, 40 deletions
diff --git a/_static/basic.css b/_static/basic.css index 08896771..4e9a9f1f 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -326,7 +326,6 @@ p.sidebar-title { } nav.contents, aside.topic, - div.admonition, div.topic, blockquote { clear: left; } @@ -334,7 +333,6 @@ div.admonition, div.topic, blockquote { /* -- topics ---------------------------------------------------------------- */ nav.contents, aside.topic, - div.topic { border: 1px solid #ccc; padding: 7px; @@ -375,7 +373,6 @@ div.sidebar > :last-child, aside.sidebar > :last-child, nav.contents > :last-child, aside.topic > :last-child, - div.topic > :last-child, div.admonition > :last-child { margin-bottom: 0; @@ -385,7 +382,6 @@ div.sidebar::after, aside.sidebar::after, nav.contents::after, aside.topic::after, - div.topic::after, div.admonition::after, blockquote::after { @@ -610,26 +606,6 @@ ol.simple p, ul.simple p { margin-bottom: 0; } - -/* Docutils 0.17 and older (footnotes & citations) */ -dl.footnote > dt, -dl.citation > dt { - float: left; - margin-right: 0.5em; -} - -dl.footnote > dd, -dl.citation > dd { - margin-bottom: 0em; -} - -dl.footnote > dd:after, -dl.citation > dd:after { - content: ""; - clear: both; -} - -/* Docutils 0.18+ (footnotes & citations) */ aside.footnote > span, div.citation > span { float: left; @@ -654,8 +630,6 @@ div.citation > p:last-of-type:after { clear: both; } -/* Footnotes & citations ends */ - dl.field-list { display: grid; grid-template-columns: fit-content(30%) auto; @@ -668,10 +642,6 @@ dl.field-list > dt { padding-right: 5px; } -dl.field-list > dt:after { - content: ":"; -} - dl.field-list > dd { padding-left: 0.5em; margin-top: 0em; diff --git a/_static/documentation_options.js b/_static/documentation_options.js index ee05e061..803b3943 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -10,5 +10,5 @@ var DOCUMENTATION_OPTIONS = { SOURCELINK_SUFFIX: '.txt', NAVIGATION_WITH_KEYS: false, SHOW_SEARCH_SUMMARY: true, - ENABLE_SEARCH_SHORTCUTS: false, + ENABLE_SEARCH_SHORTCUTS: true, };
\ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js index ac4d5861..f2fb7d5c 100644 --- a/_static/searchtools.js +++ b/_static/searchtools.js @@ -88,7 +88,7 @@ const _displayItem = (item, highlightTerms, searchTerms) => { linkEl.href = linkUrl + "?" + params.toString() + anchor; linkEl.innerHTML = title; if (descr) - listItem.appendChild(document.createElement("span")).innerText = + listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; else if (showSearchSummary) fetch(requestUrl) @@ -155,10 +155,8 @@ const Search = { _pulse_status: -1, htmlToText: (htmlString) => { - const htmlElement = document - .createRange() - .createContextualFragment(htmlString); - _removeChildren(htmlElement.querySelectorAll(".headerlink")); + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); const docContent = htmlElement.querySelector('[role="main"]'); if (docContent !== undefined) return docContent.textContent; console.warn( @@ -504,11 +502,12 @@ const Search = { * latter for highlighting it. */ makeSearchSummary: (htmlText, keywords, highlightWords) => { - const text = Search.htmlToText(htmlText).toLowerCase(); + const text = Search.htmlToText(htmlText); if (text === "") return null; + const textLower = text.toLowerCase(); const actualStartPosition = [...keywords] - .map((k) => text.indexOf(k.toLowerCase())) + .map((k) => textLower.indexOf(k.toLowerCase())) .filter((i) => i > -1) .slice(-1)[0]; const startWithContext = Math.max(actualStartPosition - 120, 0); @@ -516,9 +515,9 @@ const Search = { const top = startWithContext === 0 ? "" : "..."; const tail = startWithContext + 240 < text.length ? "..." : ""; - let summary = document.createElement("div"); + let summary = document.createElement("p"); summary.classList.add("context"); - summary.innerText = top + text.substr(startWithContext, 240).trim() + tail; + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; highlightWords.forEach((highlightWord) => _highlightText(summary, highlightWord, "highlighted") |