From 96bb5b25d93c72df1bad43224de77073ab9fa058 Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Thu, 16 Nov 2023 22:39:20 +0900
Subject: [PATCH] commenced work on documentation

---
 docs/api.md                   |  4 ----
 docs/api/frontend.md          |  8 ++++++++
 docs/api/index.md             |  0
 docs/api/tree.md              |  0
 docs/css/mkdocstrings.css     | 35 +++++++++++++++++++++++++++++++++++
 mkdocs.yml                    | 23 ++++++++++++++++++++++-
 src/pystencilssfg/composer.py |  4 ++++
 7 files changed, 69 insertions(+), 5 deletions(-)
 delete mode 100644 docs/api.md
 create mode 100644 docs/api/frontend.md
 create mode 100644 docs/api/index.md
 create mode 100644 docs/api/tree.md
 create mode 100644 docs/css/mkdocstrings.css

diff --git a/docs/api.md b/docs/api.md
deleted file mode 100644
index 3ef6207..0000000
--- a/docs/api.md
+++ /dev/null
@@ -1,4 +0,0 @@
-
-## Modules
-
-To Do
\ No newline at end of file
diff --git a/docs/api/frontend.md b/docs/api/frontend.md
new file mode 100644
index 0000000..a8edb15
--- /dev/null
+++ b/docs/api/frontend.md
@@ -0,0 +1,8 @@
+
+# Source File Composition
+
+::: pystencilssfg.composer.SfgComposer
+
+::: pystencilssfg.source_components.SfgKernelNamespace
+
+::: pystencilssfg.source_components.SfgKernelHandle
diff --git a/docs/api/index.md b/docs/api/index.md
new file mode 100644
index 0000000..e69de29
diff --git a/docs/api/tree.md b/docs/api/tree.md
new file mode 100644
index 0000000..e69de29
diff --git a/docs/css/mkdocstrings.css b/docs/css/mkdocstrings.css
new file mode 100644
index 0000000..c84bd34
--- /dev/null
+++ b/docs/css/mkdocstrings.css
@@ -0,0 +1,35 @@
+
+h2.doc-heading {
+    font-size: x-large
+}
+
+h3.doc-heading {
+    font-size: large;
+}
+
+.doc-class>.doc-heading::before {
+    font-size: small;
+    content: "class ";
+    margin-right: 5pt;
+}
+
+.doc-contents {
+    border-left: 3pt solid rgb(60, 60, 60);
+    padding-left: 10pt;
+}
+
+.doc-class .doc-children .doc-attribute>.doc-heading::before {
+    font-size: small;
+    content: "attribute ";
+    margin-right: 5pt;
+}
+
+.doc-class .doc-children .doc-function>.doc-heading::before {
+    font-size: small;
+    content: "function ";
+    margin-right: 5pt;
+}
+
+.doc-children {
+    padding-left: 10pt;
+}
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index 0e6b089..96fb45b 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -1,15 +1,36 @@
 site_name: pystencils Source File Generator Documentation
 theme: 
   name: material
+  features: navigation.tabs
+  palette:
+    scheme: slate
+    primary: deep purple
+
+extra_css:
+ - css/mkdocstrings.css
 
 plugins:
+  - search
+  - autorefs
   - mkdocstrings:
       default_handler: python
       handlers:
         python:
           paths: [src]
+          options:
+            heading_level: 2
+            show_root_heading: True
+            show_root_full_path: False
+            show_symbol_type_heading: True
+            show_symbol_type_toc: True
+            show_source: False
+            show_signature_annotations: True
+            signature_crossrefs: True
 
 
 nav:
   - Home: index.md
-  - API Documentation: api.md
+  - 'API Documentation':
+    - 'Overview': api/index.md
+    - 'Source File Generator Front-End': api/frontend.md
+    - 'Kernel Call Tree': api/tree.md
\ No newline at end of file
diff --git a/src/pystencilssfg/composer.py b/src/pystencilssfg/composer.py
index ed0dced..fc67c8c 100644
--- a/src/pystencilssfg/composer.py
+++ b/src/pystencilssfg/composer.py
@@ -16,14 +16,18 @@ if TYPE_CHECKING:
 
 
 class SfgComposer:
+    """Primary interface for constructing source files in pystencils-sfg."""
+    
     def __init__(self, ctx: SfgContext):
         self._ctx = ctx
 
     @property
     def kernels(self) -> SfgKernelNamespace:
+        """The default kernel namespace."""
         return self._ctx._default_kernel_namespace
 
     def kernel_namespace(self, name: str) -> SfgKernelNamespace:
+        """Returns the kernel namespace of the given name, creating it if it does not exist yet."""
         kns = self._ctx.get_kernel_namespace(name)
         if kns is None:
             kns = SfgKernelNamespace(self, name)
-- 
GitLab