mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-03-26 03:03:32 +01:00
Implemented new template and optimized navigation
This commit is contained in:
parent
3e1a9e9dde
commit
18fba35173
@ -1,5 +1,4 @@
|
||||
# CyMaIS
|
||||
## Cyber Master Infrastructure Solution
|
||||
# CyMaIS - Cyber Master Infrastructure Solution
|
||||
[](https://github.com/sponsors/kevinveenbirkenbach) [](https://www.patreon.com/c/kevinveenbirkenbach) [](https://buymeacoffee.com/kevinveenbirkenbach) [](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
|
||||
<img src="https://cybermaster.space/wp-content/uploads/sites/7/2023/11/FVG_8364BW-scaled.jpg" width="300" style="float: right; margin-left: 30px;">
|
||||
|
||||
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)<br />
|
||||
☎️ 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.
|
||||
|
@ -1,25 +1,19 @@
|
||||
{% macro render_headings(headings) %}
|
||||
<ul>
|
||||
{% for item in headings %}
|
||||
<li>
|
||||
<a href="{{ pathto(item.link).replace("#", "") + '#' + item.anchor }}">{{ item.text }}</a>
|
||||
{% if item.children %}
|
||||
{{ render_headings(item.children) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
{% if local_md_headings %}
|
||||
<div class="local-md-headings">
|
||||
<h3>Page Headings</h3>
|
||||
{% set ns = namespace(current_level=0) %}
|
||||
{% for item in local_md_headings %}
|
||||
{# If the current heading level is greater than the previous, open new <ul> tags #}
|
||||
{% if item.level > ns.current_level %}
|
||||
{% for i in range(ns.current_level, item.level) %}
|
||||
<ul>
|
||||
{% endfor %}
|
||||
{# If the current heading level is less than the previous, close the open <ul> tags #}
|
||||
{% elif item.level < ns.current_level %}
|
||||
{% for i in range(item.level, ns.current_level) %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<li><a href="{{ pathto(item.link).replace("#","") + "#" + item.anchor}}">{{ item.text }}</a></li>
|
||||
{% set ns.current_level = item.level %}
|
||||
{% endfor %}
|
||||
{# Close any remaining open <ul> tags #}
|
||||
{% for i in range(ns.current_level) %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{{ render_headings(local_md_headings) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -1,3 +1,3 @@
|
||||
myst-parser
|
||||
sphinx
|
||||
sphinx-rtd-theme
|
||||
sphinxawesome-theme
|
||||
|
Loading…
x
Reference in New Issue
Block a user