diff --git a/changelog.d/template.rst b/changelog.d/template.rst
new file mode 100644
index 0000000..6620eee
--- /dev/null
+++ b/changelog.d/template.rst
@@ -0,0 +1,18 @@
+{% for section, _ in sections.items() %}
+{% if section %}### {{ section }}
+
+{% endif %}
+{% if sections[section] %}
+{% for category, val in definitions.items() if category in sections[section] %}
+
+#### {{ definitions[category]['name'] }}
+
+{% for text, values in sections[section][category].items() %}
+* {{ text }} {{ values|join(', ') }}
+{% endfor %}
+{% endfor %}
+{% else %}
+No significant changes.
+
+{% endif %}
+{% endfor %}
diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css
index c9b9c22..826acd3 100644
--- a/docs/source/_static/custom.css
+++ b/docs/source/_static/custom.css
@@ -65,34 +65,62 @@
color: var(--color-sidebar-link-text--hover);
}
-/* Language switcher styles */
-.language-switcher-container {
+/* Language Switcher Styles - Furo Theme */
+.language-switcher {
+ position: fixed;
+ left: 1rem;
+ bottom: 1rem;
+ z-index: 10;
+ font-size: var(--font-size--small);
+ color: var(--color-foreground-secondary);
+ background: var(--color-background-primary);
+ border: 1px solid var(--color-background-border);
+ border-radius: 0.25rem;
+ padding: 0.5rem;
+ box-shadow: var(--shadow-sm);
+}
+
+.language-switcher__label {
+ font-weight: 500;
+ margin-bottom: 0.25rem;
+ color: var(--color-foreground-muted);
+}
+
+.language-switcher__options {
display: flex;
- justify-content: flex-start;
- align-items: center;
- padding: 0.5rem 1rem;
gap: 0.5rem;
- border-bottom: 1px solid var(--color-background-border);
+ align-items: center;
}
-.language-switcher {
- display: inline-flex;
- align-items: center;
- padding: 0.3rem 0.6rem;
+.language-switcher__current {
+ font-weight: 500;
color: var(--color-foreground-primary);
+}
+
+.language-switcher__option {
+ color: var(--color-link);
text-decoration: none;
- border-radius: 0.25rem;
- font-size: 0.875rem;
- font-weight: 500;
- transition: all 0.2s ease;
+ padding: 0.125rem 0.25rem;
+ border-radius: 0.125rem;
+ transition: background-color 0.2s ease;
}
-.language-switcher:hover {
+.language-switcher__option:hover {
background-color: var(--color-background-hover);
- color: var(--color-brand-primary);
text-decoration: none;
}
+.language-switcher__option:not(:first-child)::before {
+ content: "|";
+ color: var(--color-background-border);
+ margin-right: 0.5rem;
+}
+
+/* Fix sidebar position to accommodate language switcher */
+.sidebar-container {
+ padding-bottom: 4rem;
+}
+
/* Dark mode support */
[data-theme="dark"] .language-switcher:hover {
background-color: var(--color-background-hover);
@@ -195,3 +223,151 @@ table.docutils th {
.sidebar-search-container {
border-radius: 4px;
}
+
+/* Fix Markdown Rendering */
+.rst-content .section ul {
+ list-style: disc;
+ margin-left: 2em;
+}
+
+.rst-content .section ul li {
+ margin-bottom: 0.5em;
+}
+
+.rst-content .section ul li > p {
+ margin: 0;
+}
+
+.rst-content code {
+ padding: 2px 5px;
+ background: var(--color-background-secondary);
+ border: 1px solid var(--color-background-border);
+ border-radius: 3px;
+ font-size: 0.9em;
+}
+
+.rst-content pre {
+ padding: 12px 15px;
+ background: var(--color-background-secondary);
+ border: 1px solid var(--color-background-border);
+ border-radius: 4px;
+ overflow-x: auto;
+}
+
+/* Markdown Content Styles */
+.rst-content {
+ max-width: 100%;
+ overflow-x: auto;
+}
+
+/* Links */
+.rst-content a {
+ color: var(--color-link);
+ text-decoration: none;
+}
+
+.rst-content a:hover {
+ text-decoration: underline;
+}
+
+/* Lists */
+.rst-content ul {
+ margin-bottom: 1rem;
+}
+
+.rst-content ul li {
+ margin-bottom: 0.5rem;
+ list-style: disc;
+}
+
+/* Code */
+.rst-content code {
+ padding: 2px 5px;
+ background: var(--color-background-secondary);
+ border: 1px solid var(--color-background-border);
+ border-radius: 3px;
+ font-size: 90%;
+}
+
+.rst-content pre {
+ padding: 1rem;
+ background: var(--color-background-secondary);
+ border: 1px solid var(--color-background-border);
+ border-radius: 4px;
+ overflow-x: auto;
+}
+
+/* Badges */
+.rst-content img[src*="shields.io"],
+.rst-content img[src*="badge"],
+.rst-content img[src*="codecov.io"] {
+ display: inline-block;
+ vertical-align: middle;
+ margin: 0 2px;
+ max-height: 20px;
+}
+
+/* Badge Links */
+.rst-content a:has(img) {
+ display: inline-block;
+ text-decoration: none !important;
+ margin: 0 2px;
+}
+
+.rst-content a:has(img):hover {
+ opacity: 0.8;
+}
+
+/* Table of Contents */
+.rst-content .toctree-wrapper ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.rst-content .toctree-wrapper li {
+ margin: 0;
+ padding: 0;
+}
+
+/* Emoji and Icons */
+.rst-content img[alt*="emoji"],
+.rst-content .emoji {
+ height: 1.2em;
+ width: 1.2em;
+ margin: 0 0.1em;
+ vertical-align: -0.2em;
+}
+
+/* Headings */
+.rst-content h1,
+.rst-content h2,
+.rst-content h3,
+.rst-content h4,
+.rst-content h5,
+.rst-content h6 {
+ margin-top: 2rem;
+ margin-bottom: 1rem;
+ font-weight: 600;
+ line-height: 1.25;
+}
+
+.rst-content h1 { font-size: 2em; }
+.rst-content h2 { font-size: 1.5em; }
+.rst-content h3 { font-size: 1.25em; }
+.rst-content h4 { font-size: 1em; }
+
+/* Paragraphs */
+.rst-content p {
+ margin-bottom: 1rem;
+ line-height: 1.6;
+}
+
+/* Inline Elements */
+.rst-content strong {
+ font-weight: 600;
+}
+
+.rst-content em {
+ font-style: italic;
+}
diff --git a/docs/source/_templates/language-switcher.html b/docs/source/_templates/language-switcher.html
deleted file mode 100644
index d3c32fc..0000000
--- a/docs/source/_templates/language-switcher.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{% if languages %}
-
- {% if current_language == 'en' %}
-
- 中文
-
- {% else %}
-
- English
-
- {% endif %}
-
-{% endif %}
diff --git a/docs/source/_templates/language_switcher.html b/docs/source/_templates/language_switcher.html
index 20e9890..c66f46e 100644
--- a/docs/source/_templates/language_switcher.html
+++ b/docs/source/_templates/language_switcher.html
@@ -1,13 +1,16 @@
{%- if language %}
-
+
+
+ {% if language == 'en_US' %}Language{% else %}语言{% endif %}
+
+
+
{{ supported_languages[language]["name"] }}
+ {% for alt_lang in alternate_languages %}
+
+ {{ alt_lang.name }}
+
+ {% endfor %}
+
+
{%- endif %}
diff --git a/docs/source/_templates/languages.html b/docs/source/_templates/languages.html
deleted file mode 100644
index 207366a..0000000
--- a/docs/source/_templates/languages.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{% if language == 'en_US' %}
-
-
Language:
-
English |
-
中文
-
-{% elif language == 'zh_CN' %}
-
-{% endif %}
diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html
new file mode 100644
index 0000000..76d7bb2
--- /dev/null
+++ b/docs/source/_templates/layout.html
@@ -0,0 +1,25 @@
+{% extends "!layout.html" %}
+
+{% block scripts %}
+{{ super() }}
+
+{% endblock %}
+
+{% block document %}
+
+ {% if language == 'en_US' %}Language:{% else %}语言:{% endif %}
+
{{ supported_languages[language]["name"] }}
+ {% for lang, info in supported_languages.items() %}
+ {% if lang != language %}
+ |
{{ info.name }}
+ {% endif %}
+ {% endfor %}
+
+{{ super() }}
+{% endblock %}
diff --git a/docs/source/_templates/variants.html b/docs/source/_templates/variants.html
deleted file mode 100644
index ad5aa83..0000000
--- a/docs/source/_templates/variants.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% if languages %}
-
-{% endif %}
diff --git a/docs/source/conf.py b/docs/source/conf.py
index f7bb449..986fb32 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -10,17 +10,33 @@
# -- Project information -----------------------------------------------------
project = "persistent_ssh_agent"
-copyright = "2023, persistent_ssh_agent"
+copyright = "2024, persistent_ssh_agent"
author = "persistent_ssh_agent"
# -- General configuration ---------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
- "sphinx.ext.napoleon",
+ "sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
- "sphinx_copybutton",
+ "sphinx.ext.napoleon",
"myst_parser",
+ "sphinx_copybutton",
+ "sphinx_inline_tabs",
+]
+
+# Myst Parser settings
+myst_enable_extensions = [
+ "colon_fence",
+ "deflist",
+ "dollarmath",
+ "fieldlist",
+ "html_admonition",
+ "html_image",
+ "replacements",
+ "smartquotes",
+ "substitution",
+ "tasklist",
]
# Source parsers
@@ -29,6 +45,11 @@
".md": "markdown",
}
+# Prioritize .md over .rst for readme
+source_parsers = {
+ ".md": "markdown",
+}
+
# Suppress all warnings
suppress_warnings = [
"ref.class", # Suppress class reference warnings
@@ -44,6 +65,63 @@
html_static_path = ["_static"]
html_css_files = ["custom.css"]
+# -- Language configuration -------------------------------------------------
+language = os.getenv("SPHINX_LANGUAGE", "en_US")
+
+# Mapping of supported languages and their display names
+supported_languages = {
+ "en_US": {
+ "name": "English",
+ "url_prefix": "en_US",
+ "sphinx_lang": "en",
+ "locale": "en_US",
+ "icon": ""
+ },
+ "zh_CN": {
+ "name": "中文",
+ "url_prefix": "zh_CN",
+ "sphinx_lang": "zh_CN",
+ "locale": "zh_CN",
+ "icon": ""
+ }
+}
+
+def get_alternate_languages():
+ """Get list of alternate languages for the current page.
+
+ Returns:
+ list: List of dictionaries containing language metadata
+ for languages other than the current one.
+ """
+ alternates = []
+ current_lang = language
+ for lang_code, lang_data in supported_languages.items():
+ if lang_code != current_lang:
+ alternates.append({
+ "code": lang_code,
+ "name": lang_data["name"],
+ "url_prefix": lang_data["url_prefix"],
+ "icon": lang_data["icon"]
+ })
+ return alternates
+
+# Locale directories for translations
+locale_dirs = ["locale/"]
+gettext_compact = False
+gettext_uuid = True
+gettext_location = True
+
+# Language to use for generating the HTML full-text search index.
+html_search_language = supported_languages[language]["sphinx_lang"]
+
+# Context for templates
+html_context = {
+ "current_language": language,
+ "current_language_name": supported_languages[language]["name"],
+ "alternate_languages": get_alternate_languages(),
+ "supported_languages": supported_languages
+}
+
# Theme options
html_theme_options = {
"light_css_variables": {
@@ -57,7 +135,7 @@
"footer_icons": [
{
"name": "GitHub",
- "url": "https://github.com/yourusername/persistent_ssh_agent",
+ "url": "https://github.com/loonghao/persistent_ssh_agent",
"html": """