-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made recommend tweaks to MkDocs config to support ReadTheDocs
- Loading branch information
1 parent
e60bd2d
commit 94e2495
Showing
6 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
document.addEventListener("DOMContentLoaded", function (event) { | ||
// Trigger Read the Docs' search addon instead of Material MkDocs default | ||
document.querySelector(".md-search__input").addEventListener("focus", (e) => { | ||
const event = new CustomEvent("readthedocs-search-show"); | ||
document.dispatchEvent(event); | ||
}); | ||
}); | ||
|
||
// Use CustomEvent to generate the version selector | ||
document.addEventListener("readthedocs-addons-data-ready", function (event) { | ||
const config = event.detail.data(); | ||
const versioning = ` | ||
<div class="md-version"> | ||
<button class="md-version__current" aria-label="Select version"> | ||
${config.versions.current.slug} | ||
</button> | ||
<ul class="md-version__list"> | ||
${config.versions.active | ||
.map( | ||
(version) => ` | ||
<li class="md-version__item"> | ||
<a href="${version.urls.documentation}" class="md-version__link"> | ||
${version.slug} | ||
</a> | ||
</li>` | ||
) | ||
.join("\n")} | ||
</ul> | ||
</div>`; | ||
|
||
document | ||
.querySelector(".md-header__topic") | ||
.insertAdjacentHTML("beforeend", versioning); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% extends "base.html" %} {% block site_meta %} {{ super() }} | ||
<meta name="readthedocs-addons-api-version" content="1" /> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:root { | ||
/* Reduce Read the Docs' flyout font a little bit */ | ||
--readthedocs-flyout-font-size: 0.7rem; | ||
|
||
/* Reduce Read the Docs' notification font a little bit */ | ||
--readthedocs-notification-font-size: 0.8rem; | ||
|
||
/* This customization is not yet perfect because we can't change the `line-height` yet. */ | ||
/* See https://github.com/readthedocs/addons/issues/197 */ | ||
--readthedocs-search-font-size: 0.7rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters