Skip to content

Commit 88c471a

Browse files
docs: use readthedocs theme
1 parent 9598516 commit 88c471a

File tree

6 files changed

+117
-75
lines changed

6 files changed

+117
-75
lines changed

docs/css/custom.css

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
pre {
2+
position: relative;
3+
}
4+
5+
.copy-button {
6+
position: absolute;
7+
top: 5px;
8+
right: 5px;
9+
background: #f5f5f5;
10+
border: 1px solid #ddd;
11+
padding: 5px 10px;
12+
cursor: pointer;
13+
font-size: 12px;
14+
border-radius: 5px;
15+
}
16+
17+
.copy-button:hover {
18+
background: #e0e0e0;
19+
}
20+
21+
/* Light blue background for notes */
22+
div.admonition.note {
23+
background-color: #e3f2fd;
24+
border-left: 5px solid #2196f3;
25+
padding: 10px;
26+
margin: 10px 0;
27+
border-radius: 5px;
28+
}
29+
30+
/* Light grey background for info */
31+
div.admonition.info {
32+
background-color: #f5f5f5;
33+
border-left: 5px solid #9e9e9e;
34+
padding: 10px;
35+
margin: 10px 0;
36+
border-radius: 5px;
37+
}
38+
39+
/* Orange warning box */
40+
div.admonition.warning {
41+
background-color: #fff3e0;
42+
border-left: 5px solid #ff9800;
43+
padding: 10px;
44+
margin: 10px 0;
45+
border-radius: 5px;
46+
}

docs/js/custom.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
document.querySelectorAll("pre").forEach(function (pre) {
3+
let button = document.createElement("button");
4+
button.className = "copy-button";
5+
button.innerText = "Copy";
6+
7+
// Ensure button does not get copied
8+
button.addEventListener("click", function (event) {
9+
event.stopPropagation(); // Prevent event bubbling
10+
let codeBlock = pre.querySelector("code"); // Select only the code block
11+
if (codeBlock) {
12+
let textToCopy = codeBlock.innerText.trim(); // Trim removes trailing newlines
13+
navigator.clipboard
14+
.writeText(textToCopy)
15+
.then(() => {
16+
button.innerText = "Copied!";
17+
setTimeout(() => {
18+
button.innerText = "Copy";
19+
}, 1500);
20+
})
21+
.catch((err) => console.error("Copy failed", err));
22+
}
23+
});
24+
25+
pre.style.position = "relative"; // Ensure button stays positioned inside block
26+
pre.appendChild(button);
27+
});
28+
});
29+
30+
// Below is the Google tag for this account. Copy and paste it in the code of every page of your website, immediately after the <head> element. Don’t add more than one Google tag to each page.
31+
// <!-- Google tag (gtag.js) -->
32+
// <script async src="https://www.googletagmanager.com/gtag/js?id=G-D3SL9V30KL"></script>
33+
// <script>
34+
// window.dataLayer = window.dataLayer || [];
35+
// function gtag(){dataLayer.push(arguments);}
36+
// gtag('js', new Date());
37+
38+
// gtag('config', 'G-D3SL9V30KL');
39+
// </script>

docs/overrides/footer.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-D3SL9V30KL"></script>
2+
<script>
3+
window.dataLayer = window.dataLayer || [];
4+
function gtag(){dataLayer.push(arguments);}
5+
gtag('js', new Date());
6+
gtag('config', 'G-D3SL9V30KL'); // Replace with your tracking ID
7+
</script>

docs/overrides/main.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{% extends "base.html" %}
2+
{% block breadcrumbs %}{% endblock %}

docs/requirements.txt

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
1-
Babel==2.14.0
2-
certifi==2024.7.4
3-
charset-normalizer==3.3.2
4-
click==8.1.7
5-
colorama==0.4.6
6-
csscompressor==0.9.5
7-
ghp-import==2.1.0
8-
gitdb==4.0.11
9-
GitPython==3.1.41
10-
htmlmin2==0.1.13
11-
idna==3.7
12-
Jinja2>=3.1.6
13-
jsmin==3.0.1
14-
Markdown==3.5.2
15-
MarkupSafe==2.1.4
16-
mergedeep==1.3.4
17-
mkdocs==1.5.3
18-
mkdocs-git-revision-date-plugin==0.3.2
1+
mkdocs
2+
#https://pypi.org/project/mkdocs-git-revision-date-localized-plugin/
193
mkdocs-git-revision-date-localized-plugin
20-
mkdocs-material==9.5.6
21-
mkdocs-material-extensions==1.3.1
22-
mkdocs-minify-plugin==0.8.0
4+
#https://pypi.org/project/mkdocs-minify-plugin/
5+
mkdocs-minify-plugin
6+
#https://pypi.org/project/mkdocs-git-revision-date-plugin/
7+
mkdocs-git-revision-date-plugin
8+
#https://pypi.org/project/mkdocs-material/
9+
mkdocs-material
10+
#https://pypi.org/project/mkdocs-material-extensions/
11+
mkdocs-material-extensions
12+
#https://github.com/jimporter/mike
2313
mike
24-
packaging==23.2
25-
paginate==0.5.6
26-
pathspec==0.12.1
27-
platformdirs==4.1.0
28-
Pygments==2.17.2
29-
pymdown-extensions==10.7
30-
python-dateutil==2.8.2
31-
PyYAML==6.0.1
32-
pyyaml_env_tag==0.1
33-
regex==2023.12.25
34-
requests==2.32.2
35-
six==1.16.0
36-
smmap==5.0.1
37-
urllib3==2.2.2
38-
watchdog==3.0.0

mkdocs.yml

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,21 @@ repo_name: CCBR/XAVIER
1010
repo_url: https://github.com/CCBR/XAVIER
1111
edit_uri: https://github.com/CCBR/XAVIER/edit/unified/docs/
1212

13-
# Extra
14-
extra_css:
15-
- css/extra.css
16-
1713
# Copyright
18-
copyright: Copyright &copy; 2023 CCBR
14+
copyright: Copyright &copy; 2023-{{ now().year }} CCBR
1915

2016
# Configuration
2117
theme:
22-
name: material
23-
features:
24-
- navigation.tabs
25-
- navigation.top
26-
- toc.integrate
27-
palette:
28-
- scheme: default
29-
primary: indigo
30-
accent: indigo
31-
toggle:
32-
icon: material/toggle-switch-off-outline
33-
name: Switch to dark mode
34-
- scheme: slate
35-
primary: red
36-
accent: red
37-
toggle:
38-
icon: material/toggle-switch
39-
name: Switch to light mode
40-
logo: assets/icons/doc-book.svg
41-
favicon: assets/favicon/favicon.ico
42-
18+
name: readthedocs
19+
locale: en
20+
custom_dir: docs/overrides
21+
#
4322
# Plugins
4423
plugins:
4524
- search
4625
- git-revision-date
4726
- minify:
4827
minify_html: true
49-
- mike:
50-
alias_type: symlink
51-
canonical_version: latest
52-
version_selector: true
5328

5429
# Customization
5530
extra:
@@ -60,8 +35,13 @@ extra:
6035
link: https://github.com/CCBR
6136
- icon: fontawesome/brands/docker
6237
link: https://hub.docker.com/orgs/nciccbr/repositories
63-
version:
64-
provider: mike
38+
# version:
39+
# provider: mike
40+
41+
extra_css:
42+
- css/custom.css
43+
extra_javascript:
44+
- js/custom.js
6545

6646
# Extensions
6747
markdown_extensions:
@@ -77,16 +57,9 @@ markdown_extensions:
7757
- pymdownx.caret
7858
- pymdownx.critic
7959
- pymdownx.details
80-
- pymdownx.emoji:
81-
emoji_index: !!python/name:materialx.emoji.twemoji
82-
emoji_generator: !!python/name:materialx.emoji.to_svg
8360
- pymdownx.highlight
8461
- pymdownx.inlinehilite
8562
- pymdownx.keys
86-
- pymdownx.magiclink:
87-
repo_url_shorthand: true
88-
user: squidfunk
89-
repo: mkdocs-material
9063
- pymdownx.mark
9164
- pymdownx.smartsymbols
9265
- pymdownx.snippets:

0 commit comments

Comments
 (0)