Skip to content
Merged
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
5 changes: 5 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
.sidebar-container {
width: 255px;
}

kbd:not(.compound) {
box-shadow: none!important;
color: black;
}
144 changes: 144 additions & 0 deletions docs/source/_templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<!doctype html>
<html class="no-js" {% if language is not none %} lang="{{ language }}" {% endif %}>

<head>
{%- block site_meta -%}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="color-scheme" content="light dark">

{%- if metatags %}{{ metatags }}{% endif -%}

{%- block linktags %}
{%- if hasdoc('about') -%}
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
{%- endif -%}
{%- if hasdoc('genindex') -%}
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
{%- endif -%}
{%- if hasdoc('search') -%}
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
{%- endif -%}
{%- if hasdoc('copyright') -%}
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
{%- endif -%}
{%- if next -%}
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
{%- endif -%}
{%- if prev -%}
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
{%- endif -%}
{#- rel="canonical" (set by html_baseurl) -#}
{%- if pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif %}
{%- endblock linktags %}

{# Favicon #}
{%- if favicon_url -%}
<link rel="shortcut icon" href="{{ favicon_url }}" />
{%- endif -%}

{#- Generator banner -#}
<meta name="generator" content="sphinx-{{ sphinx_version }}, furo {{ furo_version }}" />

{%- endblock site_meta -%}

{#- Site title -#}
{%- block htmltitle -%}
{% if not docstitle %}
<title>{{ title|striptags|e }}</title>
{% elif pagename == master_doc %}
<title>{{ docstitle|striptags|e }}</title>
{% else %}
<title>{{ title|striptags|e }} - {{ docstitle|striptags|e }}</title>
{% endif %}
{%- endblock -%}

{%- block styles -%}

{# Custom stylesheets #}
{%- block regular_styles -%}
{%- for css in css_files -%}
{% if css|attr("filename") -%}
{{ css_tag(css) }}
{%- else -%}
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
{%- endif %}
{% endfor -%}
{%- endblock regular_styles -%}

{#- Theme-related stylesheets -#}
{%- block theme_styles %}
{% include "partials/_head_css_variables.html" with context %}
{%- endblock -%}

{%- block extra_styles %}
{%- endblock -%}

{%- endblock styles -%}

{#- Custom front matter #}
{%- block extrahead -%}{%- endblock -%}
</head>

<body>
{% block body %}
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
{% endblock %}

{%- block scripts -%}
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script>
const versionFromURL = (url) => {
fragments = url.split("/en/")
version = undefined
if (fragments.length === 2) {
version = fragments[1].split("/")[0]

// NOTE: The version string will resolve to the PR number for RTD sites.
// Checking whether first charater is a number.
if (version[0] >= '0' && version[0] <= '9') {
version = undefined
}
}

return version
}

const siteVersion = versionFromURL(window.location.href) || "latest"
docsearch({
appId: "C0N22DVO6B",
apiKey: "235ca7d524b3067aa476523449bba0db",
indexName: "mosaicml",
container: '#algoliasearch',
searchParameters: {
filters: `version:${siteVersion}`,
attributesToRetrieve: ['*']
},
transformItems(items) {
return items.map((item) => {
item._snippetResult.hierarchy.lvl1.value += ` (${item.version})`
return item
});
},
debug: false // Set debug to true if you want to inspect the modal
});
</script>

{# Custom JS #}
{%- block regular_scripts -%}
{% for path in script_files -%}
{{ js_tag(path) }}
{% endfor -%}
{%- endblock regular_scripts -%}

{# Theme-related JavaScript code #}
{%- block theme_scripts -%}
{%- endblock -%}
{%- endblock scripts -%}
</body>

</html>
3 changes: 3 additions & 0 deletions docs/source/_templates/sidebar/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div style="padding-top: 1rem;">
<div id="algoliasearch"></div>
</div>
6 changes: 2 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,8 @@ def _get_commit_sha() -> str:
html_title = ' Composer'

# Customize CSS
html_css_files = ['css/custom.css']
html_js_files = [
'js/posthog.js',
]
html_css_files = ['css/custom.css', 'https://cdn.jsdelivr.net/npm/@docsearch/css@3']
html_js_files = ['js/posthog.js']

# Mosaic logo
# html_logo = 'https://storage.googleapis.com/docs.mosaicml.com/images/logo-dark-bg.png'
Expand Down