diff --git a/sphinx/_templates/local_md_files.html b/sphinx/_templates/local_md_files.html
new file mode 100644
index 00000000..3a6441e5
--- /dev/null
+++ b/sphinx/_templates/local_md_files.html
@@ -0,0 +1,10 @@
+{% if local_md_files %}
+
+
Local Markdown Files
+
+
+{% endif %}
diff --git a/sphinx/conf.py b/sphinx/conf.py
index 74cf3ffc..9ae401ad 100644
--- a/sphinx/conf.py
+++ b/sphinx/conf.py
@@ -7,6 +7,8 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import sys
+import os
+sys.path.insert(0, os.path.abspath('.'))
project = 'CyMaIS - Cyber Master Infrastructure Solution'
copyright = '2025, Kevin Veen-Birkenbach'
@@ -15,8 +17,6 @@ author = 'Kevin Veen-Birkenbach'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
-extensions = []
-
templates_path = ['_templates']
exclude_patterns = ['docs', 'venv', 'venv/**']
@@ -27,14 +27,18 @@ exclude_patterns = ['docs', 'venv', 'venv/**']
html_theme = 'alabaster'
html_static_path = ['_static']
+
html_sidebars = {
'**': [
- 'localtoc.html', # Zeigt die lokale Navigation an
- 'relations.html', # Vorherige/Nächste Seite
- 'searchbox.html', # Suchfeld
+ 'globaltoc.html',
+ 'relations.html',
+ 'sourcelink.html',
+ 'local_md_files.html', # Include your custom template
+ 'searchbox.html',
]
}
+
html_theme_options = {
'fixed_sidebar': True,
}
@@ -49,6 +53,7 @@ extensions = [
"sphinx.ext.autosummary",
"sphinx.ext.autodoc",
"myst_parser",
+ 'local_md_files',
]
autosummary_generate = True
diff --git a/sphinx/local_md_files.py b/sphinx/local_md_files.py
new file mode 100644
index 00000000..8a5963c3
--- /dev/null
+++ b/sphinx/local_md_files.py
@@ -0,0 +1,30 @@
+import os
+from sphinx.util import logging
+
+logger = logging.getLogger(__name__)
+
+def add_local_md_files(app, pagename, templatename, context, doctree):
+ srcdir = app.srcdir
+ # Determine the directory of the current page (e.g., "directory/file" → "directory")
+ directory = os.path.dirname(pagename)
+ abs_dir = os.path.join(srcdir, directory)
+ if not os.path.isdir(abs_dir):
+ logger.warning(f"Directory {abs_dir} not found for page {pagename}.")
+ context['local_md_files'] = []
+ return
+
+ md_files = []
+ for file in os.listdir(abs_dir):
+ if file.endswith('.md'):
+ # Optionally: Skip the current file in the list
+ if file == os.path.basename(pagename):
+ continue
+ # Create a link relative to the source directory
+ link = os.path.join(directory, file) if directory else file
+ md_files.append({'name': file, 'link': link})
+ context['local_md_files'] = md_files
+
+def setup(app):
+ # Connect the handler to the "html-page-context" event
+ app.connect('html-page-context', add_local_md_files)
+ return {'version': '0.1', 'parallel_read_safe': True}