diff --git a/README.md b/README.md index 91da99b8..0da5b639 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -# CyMaIS -## Cyber Master Infrastructure Solution +# CyMaIS - Cyber Master Infrastructure Solution [![GitHub Sponsors](https://img.shields.io/badge/Sponsor-GitHub%20Sponsors-blue?logo=github)](https://github.com/sponsors/kevinveenbirkenbach) [![Patreon](https://img.shields.io/badge/Support-Patreon-orange?logo=patreon)](https://www.patreon.com/c/kevinveenbirkenbach) [![Buy Me a Coffee](https://img.shields.io/badge/Buy%20me%20a%20Coffee-Funding-yellow?logo=buymeacoffee)](https://buymeacoffee.com/kevinveenbirkenbach) [![PayPal](https://img.shields.io/badge/Donate-PayPal-blue?logo=paypal)](https://s.veen.world/paypaldonate) @@ -15,7 +14,7 @@ Our intuitive interface, coupled with in-depth documentation, makes it accessibl With CyMaIS, setting up a secure, scalable, and robust IT infrastructure is not just faster and easier, but also aligned with the best industry practices, ensuring that your organization stays ahead in the ever-evolving digital landscape. -### Vision +## Vision Our project is anchored in the vision of transforming IT infrastructure deployment into a seamless, secure, and scalable experience. We are committed to developing a fully automated solution that enables businesses of any size and industry to set up a 100% secure and infinitely scalable IT infrastructure in just 24 hours. @@ -46,7 +45,7 @@ For a deeper understanding of our goals and the ethos driving our project, we in CyMaIS is more than just an IT solution; it's a commitment to empowering your business with the technology it needs to thrive in today’s digital landscape, effortlessly and securely. -### Professional CyMaIS Implementation +## Professional CyMaIS Implementation My name is Kevin Veen-Birkenbach and I'm glad to assist you in the implementation of your secure and scalable IT infrastrucutre solution with CyMaIS. @@ -61,6 +60,6 @@ Contact me for more details: 📧 Email: [kevin@veen.world](mailto:kevin@veen.world)
☎️ Phone: [+ 49 178 179 80 23](tel:00491781798023) -### License +## License This project is licensed from Kevin Veen-Birkenbach. The full license is available in the [LICENSE.md](./LICENSE.md) of this repository. diff --git a/sphinx/_templates/local_md_files.html b/sphinx/_templates/local_md_files.html index 83743b9c..b73f1c6f 100644 --- a/sphinx/_templates/local_md_files.html +++ b/sphinx/_templates/local_md_files.html @@ -1,25 +1,19 @@ +{% macro render_headings(headings) %} + +{% endmacro %} + {% if local_md_headings %}

Page Headings

- {% set ns = namespace(current_level=0) %} - {% for item in local_md_headings %} - {# If the current heading level is greater than the previous, open new
{% endif %} diff --git a/sphinx/conf.py b/sphinx/conf.py index 225565df..5b55dbef 100644 --- a/sphinx/conf.py +++ b/sphinx/conf.py @@ -25,7 +25,7 @@ exclude_patterns = ['docs', 'venv', 'venv/**'] # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -html_theme = 'alabaster' +html_theme = 'sphinxawesome_theme' html_static_path = ['_static'] html_sidebars = { @@ -40,7 +40,7 @@ html_sidebars = { html_theme_options = { - 'fixed_sidebar': True, + # 'fixed_sidebar': True, } # Liste der Dateiendungen, die Sphinx verarbeiten soll: diff --git a/sphinx/local_md_files.py b/sphinx/local_md_files.py index 0ef4bb1b..86be410e 100644 --- a/sphinx/local_md_files.py +++ b/sphinx/local_md_files.py @@ -47,14 +47,37 @@ def extract_headings_from_file(filepath, max_level=MAX_HEADING_LEVEL): logger.warning(f"Error reading {filepath}: {e}") return headings +def group_headings(headings): + """ + Converts a flat list of headings into a tree structure based on their level. + Each heading gets a 'children' list. + """ + tree = [] + stack = [] + for heading in headings: + heading['children'] = [] + # Pop headings from the stack that are at or deeper than the current level + while stack and stack[-1]['level'] >= heading['level']: + stack.pop() + if stack: + # Append the current heading as a child of the last item in the stack + stack[-1]['children'].append(heading) + else: + tree.append(heading) + stack.append(heading) + return tree + +def sort_tree(tree): + """ + Sorts a list of headings (and their children) by their text. + """ + tree.sort(key=lambda x: natural_sort_key(x['text'])) + for node in tree: + if node.get('children'): + sort_tree(node['children']) + def add_local_md_headings(app, pagename, templatename, context, doctree): - """ - For every Markdown file in the same directory as the current page, - extract its headings, sort them in natural ascending order, and add them - to the context. - """ 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): @@ -68,17 +91,18 @@ def add_local_md_headings(app, pagename, templatename, context, doctree): filepath = os.path.join(abs_dir, file) headings = extract_headings_from_file(filepath) for heading in headings: - # Build file link: zunächst Pfad + Dateiname, dann Ersetzen der .md-Endung durch .html - file_link = os.path.join(directory, file).replace(".md","") if directory else file + base = file[:-3] + file_link = os.path.join(directory, base) local_md_headings.append({ 'level': heading['level'], 'text': heading['text'], 'link': file_link, 'anchor': heading['anchor'] }) - # Sort headings in natural ascending order using natural_sort_key. - local_md_headings.sort(key=lambda x: natural_sort_key(x['text'])) - context['local_md_headings'] = local_md_headings + # Proceed with grouping and sorting as before... + tree = group_headings(local_md_headings) + sort_tree(tree) + context['local_md_headings'] = tree def setup(app): app.connect('html-page-context', add_local_md_headings) diff --git a/sphinx/requirements.txt b/sphinx/requirements.txt index 8430e288..6efb08d7 100644 --- a/sphinx/requirements.txt +++ b/sphinx/requirements.txt @@ -1,3 +1,3 @@ myst-parser sphinx -sphinx-rtd-theme +sphinxawesome-theme