From f2382a2bc62923fc44fac2e1d89f5ccf557b68bc Mon Sep 17 00:00:00 2001 From: Lohith K S Date: Mon, 18 Sep 2023 01:47:36 -0400 Subject: [PATCH] Adding Algolia search to Eva-DB Docs This Commit contains necessary css & js file changes and algolia configuration details to add algolia search to eva-db documentation page. --- docs/_static/algolia.css | 74 ++++++++++++++++++++++++++++++++++++++ docs/_static/js/algolia.js | 7 ++++ docs/conf.py | 4 +++ 3 files changed, 85 insertions(+) create mode 100644 docs/_static/algolia.css create mode 100644 docs/_static/js/algolia.js diff --git a/docs/_static/algolia.css b/docs/_static/algolia.css new file mode 100644 index 0000000000..123707e466 --- /dev/null +++ b/docs/_static/algolia.css @@ -0,0 +1,74 @@ +/* Hide search button */ +.sidebar-search-container { + display: none; +} + +/* Hide the search wrapper window when hitting Ctrl+K */ +.search-button__wrapper.show { + display: none !important; +} + +/* Make sure Algolia's search container is always on top */ +.bd-article-container { + z-index: 10; +} + +@media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) .DocSearch-Button { + background-color: #3d4751 !important; + color: white !important; + } + + body:not([data-theme="light"]) .DocSearch-Search-Icon { + color: white !important; + } + + body:not([data-theme="light"]) .DocSearch-Button-Key { + color: black !important; + box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 0.01rem #3d4751 !important; + } + + body:not([data-theme="light"]) .DocSearch-Commands-Key { + color: black !important; + box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 .01rem #858a8f !important; + } +} + +@media (prefers-color-scheme: dark) { + body[data-theme="dark"] .DocSearch-Button { + background-color: #3d4751 !important; + color: white !important; + } + + body[data-theme="dark"] .DocSearch-Search-Icon { + color: white !important; + } + + body[data-theme="dark"] .DocSearch-Button-Key { + color: black !important; + box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 0.01rem #3d4751 !important; + } + + body[data-theme="dark"] .DocSearch-Commands-Key { + color: black !important; + box-shadow: 0 .0625rem 0 rgba(0, 0, 0, .2), inset 0 0 0 .01rem #858a8f !important; + } +} + +.DocSearch-Button-Key { + font-family: "SFMono-Regular", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace !important; + padding: 0 !important; + padding-top: 0.1rem !important; + display: flex; + align-items: center; + justify-content: center; +} + +.DocSearch-Commands-Key { + font-family: "SFMono-Regular", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace !important; + padding: 0 !important; + padding-left: 0.05rem !important; + display: flex; + align-items: center; + justify-content: center; +} \ No newline at end of file diff --git a/docs/_static/js/algolia.js b/docs/_static/js/algolia.js new file mode 100644 index 0000000000..f3a0b983fa --- /dev/null +++ b/docs/_static/js/algolia.js @@ -0,0 +1,7 @@ + docsearch({ + container: '#searchbox', + appId: 'PLVPFSHT36', + indexName: 'evadb', + apiKey: 'c6c7572adcfbe7c891016aca9598d131', + debug: false, + }); diff --git a/docs/conf.py b/docs/conf.py index 644db7510f..1c78822dd3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -148,6 +148,8 @@ html_static_path = ["_static"] html_css_files = [ "custom.css", + "algolia.css", + "https://cdn.jsdelivr.net/npm/@docsearch/css@3", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/fontawesome.min.css", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/solid.min.css", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/brands.min.css"] @@ -166,3 +168,5 @@ def setup(app): ) # Custom JS app.add_js_file("js/top-navigation.js", defer="defer") + app.add_js_file("https://cdn.jsdelivr.net/npm/@docsearch/js@3.3.3/dist/umd/index.js",defer="defer") + app.add_js_file("js/algolia.js",defer="defer")