diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..c4143cb
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,13 @@
+[paths]
+content_dir = "/home/dubey/projects/foldsite/docs/content"
+templates_dir = "/home/dubey/projects/foldsite/docs/templates"
+styles_dir = "/home/dubey/projects/foldsite/docs/styles"
+
+[server]
+listen_address = "0.0.0.0"
+listen_port = 8080
+enable_admin_browser = false
+admin_password = "password"
+max_threads = 4
+debug = false
+access_log = true
diff --git a/docs/content/Configuration.md b/docs/content/Configuration.md
new file mode 100644
index 0000000..baa918f
--- /dev/null
+++ b/docs/content/Configuration.md
@@ -0,0 +1,35 @@
+# Configuration
+
+## Configuration file
+
+Foldsite is configured using a TOML file (default: `config.toml`). This file specifies paths to content, templates, and styles, as well as server settings.
+
+Example `config.toml`:
+
+```toml
+[paths]
+content_dir = "/home/myuser/site/content"
+templates_dir = "/home/myuser/site/themes/cobalt/templates"
+styles_dir = "/home/myuser/site/themes/cobalt/styles"
+
+[server]
+listen_address = "127.0.0.1"
+listen_port = 8080
+debug = false
+access_log = true
+max_threads = 4
+admin_browser = false
+admin_password = "your_admin_password"
+```
+
+## Server Settings
+
+ - **`listen_address`**: The IP address the server listens on (default: `127.0.0.1`).
+ - **`listen_port`**: The port the server listens on (default: `8080`).
+ - **`debug`**: Enables or disables debug mode (default: `false`). In debug mode, the server will automatically reload when code changes are detected, and more detailed error messages will be shown.
+ - **`access_log`**: Enables or disables access logging (default: `true`). If enabled, access logs will be written to standard output.
+ - **`max_threads`**: The maximum number of threads to use for handling requests (default: `4`). This setting directly impacts the concurrency of the server.
+ - **`admin_browser`**: Enables or disables the built-in file manager (default: `false`).
+ - **`admin_password`**: Sets the password for the file manager. Required if `admin_browser` is `true`.
+
+The `Configuration` class (`/foldsite/src/config/config.py`) is responsible for loading and parsing this configuration file. It also sets global variables (`CONTENT_DIR`, `TEMPLATES_DIR`, `STYLES_DIR`) for easy access to these directories throughout the application. Errors are raised if the config file is missing, invalid, or lacks required sections (like `paths` or `server`).
\ No newline at end of file
diff --git a/docs/content/Rendering Process.md b/docs/content/Rendering Process.md
new file mode 100644
index 0000000..b12d9bf
--- /dev/null
+++ b/docs/content/Rendering Process.md
@@ -0,0 +1,56 @@
+## Rendering Process
+
+The `RouteManager` class (`/foldsite/src/routes/routes.py`) and `render_page` function (`/foldsite/src/rendering/renderer.py`) are central to the rendering process.
+
+### How Foldsite Determines File Types
+
+The `determine_type` function (in `renderer.py`) is crucial for figuring out how to handle a given file or directory. It examines file extensions and directory contents to classify files into broad categories (defined in `GENERIC_FILE_MAPPING` in `/foldsite/src/rendering/__init__.py`):
+
+* **`document`**: Files with extensions like `.md`, `.txt`, and `.html`.
+* **`image`**: Files with extensions like `.png`, `.jpg`, `.jpeg`, `.gif`, and `.svg`.
+* **`directory`**: Directories. If a directory contains files, the most common file extension within that directory is used to infer the directory's "type".
+* **`other`**: Files that don't match any of the above categories.
+* **`multimedia`**: This is a combination that contains `image`.
+
+### Template Search
+
+When a request comes in, Foldsite searches for an appropriate template in the `templates` directory. The search logic is implemented in `render_page` and follows a specific order, prioritizing more specific templates:
+
+1. **Exact Path Match:** If a template exists with the exact same path relative to the `templates` directory as the requested content file (but with a `.html` extension), it's used. For example, if the request is for `/about/team.md`, and a template exists at `templates/about/team.md.html`, that template will be used.
+
+2. **Folder-Specific Template:** If the requested path is a directory, Foldsite looks for a `__folder.html` template within that directory. For example, if the request is for `/blog/`, and `templates/blog/__folder.html` exists, it will be used.
+
+3. **Type and Extension-Specific Templates:** Foldsite searches for templates named `__{type}.{extension}.html` within the requested directory and its parent directories, moving upwards. For instance, if requesting `/blog/post1.md`, it would look for:
+ * `templates/blog/__file.md.html`
+ * `templates/__file.md.html`
+
+4. **Type and Category-Specific Templates:** Similar to the above, but searches for `__{type}.{category}.html`. If requesting an image at `/images/logo.png`, it looks for:
+
+ * `templates/images/__file.image.html`
+ * `templates/__file.image.html`
+
+5. **Base Template:** Finally, if no other template is found, `templates/base.html` is used as a fallback. This template *must* exist; otherwise, an exception is raised.
+
+### Style Search
+
+CSS styles are searched similarly to templates, prioritizing specificity:
+
+1. **Exact Path Match:** A CSS file with the exact same path as the requested content file (relative to the `styles` directory) is used. For example, `/about/team.md` would look for `styles/about/team.md.css`.
+
+2. **Type and Extension-Specific Styles:** Searches for `__{type}.{extension}.css` in the requested directory and its parent directories. For example, `/blog/post1.md` would look for:
+
+ * `styles/blog/__file.md.css`
+ * `styles/__file.md.css`
+
+3. **Type and Category-Specific Styles:** Similar to the above, but searches for `__{type}.{category}.css`.
+
+ * `styles/images/__file.image.css`
+ * `styles/__file.image.css`
+
+4. **Base Style:** `styles/base.css` is always included.
+
+The discovered styles are added to the `styles` variable, which is passed to the Jinja2 template. The order ensures that more specific styles override general ones.
+
+### Error Handling
+
+The `render_error_page` function (in `renderer.py`) handles errors. If a requested resource is not found (404 error) or if an exception occurs during processing, this function is called. It looks for a template named `__error.html` in the `templates` directory. If found, it's used to render the error page; otherwise, a default error page is generated. The error code, message, and description are passed to the template.
\ No newline at end of file
diff --git a/docs/content/added-tools.md b/docs/content/added-tools.md
deleted file mode 100644
index 0be0284..0000000
--- a/docs/content/added-tools.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Added Tools for the Template
-
-Foldsite provides additional tools for templates, such as functions to get sibling content files, text document previews, and folder contents.
diff --git a/docs/content/configuration.md b/docs/content/configuration.md
deleted file mode 100644
index 83a8f86..0000000
--- a/docs/content/configuration.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Configuration
-
-The configuration file is written in TOML format and contains various settings for the application. Below is an example configuration file (`config.toml`):
-
-```toml
-[paths]
-content_dir = "example/content"
-templates_dir = "templates"
-styles_dir = "styles"
-
-[server]
-listen_address = "127.0.0.1"
-listen_port = 8080
-debug = false
-access_log = true
-max_threads = 4
-admin_browser = false
-admin_password = "your_admin_password"
-```
diff --git a/docs/content/deployment.md b/docs/content/deployment.md
deleted file mode 100644
index 38268ad..0000000
--- a/docs/content/deployment.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Deployment
-
-To deploy Foldsite, you can use Docker. Below is an example Dockerfile:
-
-```dockerfile
-FROM python:3.13.2-bookworm
-WORKDIR /app
-COPY requirements.txt requirements.txt
-RUN pip install --no-cache-dir -r requirements.txt
-COPY . .
-CMD ["python", "main.py"]
-```
diff --git a/docs/content/docker-compose-example.md b/docs/content/docker-compose-example.md
deleted file mode 100644
index 72e4e49..0000000
--- a/docs/content/docker-compose-example.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Docker Compose Example
-
-Below is an example `docker-compose.yml` file to deploy Foldsite using Docker Compose:
-
-```yaml
-version: '3.8'
-services:
- foldsite:
- build: .
- ports:
- - "8080:8080"
- volumes:
- - .:/app
- environment:
- - CONFIG_PATH=config.toml
-```
diff --git a/docs/content/example-usages.md b/docs/content/example-usages.md
deleted file mode 100644
index 937657a..0000000
--- a/docs/content/example-usages.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Example Usages for Tools and Types
-
-### Example Usage of `get_sibling_content_files`
-
-```html
-
- {% for file in get_sibling_content_files('path/to/directory') %}
-
{{ file[0] }} - {{ file[1] }}
- {% endfor %}
-
-```
-
-### Example Usage of `get_text_document_preview`
-
-```html
-
-```
-
-### Example Usage of `get_sibling_content_folders`
-
-```html
-
- {% for folder in get_sibling_content_folders('path/to/directory') %}
-
{{ folder[0] }} - {{ folder[1] }}
- {% endfor %}
-
-```
-
-### Example Usage of `get_folder_contents`
-
-```html
-
- {% for item in get_folder_contents('path/to/directory') %}
-
{{ item.name }} - {{ item.path }}
- {% endfor %}
-
-```
diff --git a/docs/content/folder-layout.md b/docs/content/folder-layout.md
deleted file mode 100644
index e69de29..0000000
diff --git a/docs/content/how-template-written.md b/docs/content/how-template-written.md
deleted file mode 100644
index 47b28bc..0000000
--- a/docs/content/how-template-written.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# How a Template is Written
-
-Templates are written in HTML and use Jinja2 syntax for dynamic content. Below is an example template (`base.html`):
-
-```html
-
-
-
-
-
- {{ title }}
-
- {% for style in styles %}
-
- {% endfor %}
-
-
-
- {{ content }}
-
-
-
-```
diff --git a/docs/content/index.md b/docs/content/index.md
index 086712f..b86d8ad 100644
--- a/docs/content/index.md
+++ b/docs/content/index.md
@@ -1,20 +1,3 @@
# Foldsite Documentation
-Welcome to the Foldsite documentation. This site will guide you through the setup, configuration, and usage of Foldsite.
-
-## Table of Contents
-
-1. [Introduction](introduction.md)
-2. [Configuration](configuration.md)
-3. [Template Setup](template-setup.md)
-4. [Site Setup](site-setup.md)
-5. [Style Setup](style-setup.md)
-6. [Template and Style Search](template-style-search.md)
-7. [How a Template is Written](how-template-written.md)
-8. [Jinja Primer](jinja-primer.md)
-9. [Added Tools for the Template](added-tools.md)
-10. [Tool Input and Return Types](tool-input-return-types.md)
-11. [Example Usages for Tools and Types](example-usages.md)
-12. [Deployment](deployment.md)
-13. [Docker Compose Example](docker-compose-example.md)
-14. [Folder Layout](folder-layout.md)
+Foldsite acts as a dynamic site generator. It takes content primarily from Markdown files, combines it with HTML templates, applies CSS styles, and serves the resulting pages. It supports features like image thumbnails, Markdown rendering with frontmatter, and a built-in file manager for administrative tasks. Foldsite is dynamic in the sense that content is rendered on demand, rather than generating static HTML up-front.
\ No newline at end of file
diff --git a/docs/content/introduction.md b/docs/content/introduction.md
deleted file mode 100644
index 9721717..0000000
--- a/docs/content/introduction.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Introduction
-
-Foldsite is a dynamic site generator built with Python and Flask. It allows you to create and manage a website using Markdown content, HTML templates, and CSS styles.
-
-This documentation will guide you through the setup, configuration, and usage of Foldsite.
diff --git a/docs/content/jinja-primer.md b/docs/content/jinja-primer.md
deleted file mode 100644
index 4309c66..0000000
--- a/docs/content/jinja-primer.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# Jinja Primer
-
-Jinja2 is a templating engine for Python. It allows you to include dynamic content in your HTML templates. Below are some basic Jinja2 syntax examples:
-
-- Variables: `{{ variable }}`
-- Loops: `{% for item in list %} ... {% endfor %}`
-- Conditionals: `{% if condition %} ... {% endif %}`
-- Includes: `{% include 'template.html' %}`
diff --git a/docs/content/site-setup.md b/docs/content/site-setup.md
deleted file mode 100644
index 856ca18..0000000
--- a/docs/content/site-setup.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Site Setup
-
-The site content is stored in the `content` directory. Each Markdown file represents a page on your site. The directory structure of the `content` directory determines the URL structure of your site.
diff --git a/docs/content/style-setup.md b/docs/content/style-setup.md
deleted file mode 100644
index a33fbbf..0000000
--- a/docs/content/style-setup.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Style Setup
-
-Styles are CSS files that define the appearance of your web pages. They are stored in the `styles` directory. You can create specific styles for different types of content and categories.
diff --git a/docs/content/template-setup.md b/docs/content/template-setup.md
deleted file mode 100644
index ebc33fa..0000000
--- a/docs/content/template-setup.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Template Setup
-
-Templates are HTML files that define the structure of your web pages. They are stored in the `templates` directory. Each template can include other templates and use Jinja2 syntax for dynamic content.
diff --git a/docs/content/template-style-search.md b/docs/content/template-style-search.md
deleted file mode 100644
index 6fe8a43..0000000
--- a/docs/content/template-style-search.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Template and Style Search
-
-Templates and styles are searched in a specific order to apply the most specific styles first, followed by more general styles, and finally the base style.
diff --git a/docs/content/tool-input-return-types.md b/docs/content/tool-input-return-types.md
deleted file mode 100644
index f2896d8..0000000
--- a/docs/content/tool-input-return-types.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Tool Input and Return Types
-
-### `get_sibling_content_files(path: str) -> list`
-Returns a list of sibling content files in the specified directory.
-
-### `get_text_document_preview(path: str) -> str`
-Generates a preview of the text document located at the given path.
-
-### `get_sibling_content_folders(path: str) -> list`
-Returns a list of sibling content folders within a specified directory.
-
-### `get_folder_contents(path: str) -> list`
-Retrieves the contents of a folder and returns a list of `TemplateFile` objects.
diff --git a/docs/styles/__file.md.css b/docs/styles/__file.md.css
index e471e26..ba72ea5 100644
--- a/docs/styles/__file.md.css
+++ b/docs/styles/__file.md.css
@@ -3,7 +3,12 @@ article {
margin: 0 auto;
}
-article h1, article h2, article h3, article h4, article h5, article h6 {
+article h1,
+article h2,
+article h3,
+article h4,
+article h5,
+article h6 {
margin-top: 1.5rem;
}
@@ -11,14 +16,8 @@ article p {
margin: 1rem 0;
}
-article pre {
- background: #f4f4f4;
- padding: 1rem;
- overflow-x: auto;
-}
-
article code {
- background: #f4f4f4;
+ background: var(--code-background-color);
padding: 0.2rem 0.4rem;
border-radius: 3px;
-}
+}
\ No newline at end of file
diff --git a/docs/styles/base.css b/docs/styles/base.css
index 2361ccf..91189e8 100644
--- a/docs/styles/base.css
+++ b/docs/styles/base.css
@@ -1,50 +1,280 @@
+/* http://meyerweb.com/eric/tools/css/reset/
+ v2.0 | 20110126
+ License: none (public domain)
+*/
+
+html,
+body,
+div,
+span,
+applet,
+object,
+iframe,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+p,
+blockquote,
+pre,
+a,
+abbr,
+acronym,
+address,
+big,
+cite,
+code,
+del,
+dfn,
+em,
+img,
+ins,
+kbd,
+q,
+s,
+samp,
+small,
+strike,
+strong,
+sub,
+sup,
+tt,
+var,
+b,
+u,
+i,
+center,
+dl,
+dt,
+dd,
+ol,
+ul,
+li,
+fieldset,
+form,
+label,
+legend,
+table,
+caption,
+tbody,
+tfoot,
+thead,
+tr,
+th,
+td,
+article,
+aside,
+canvas,
+details,
+embed,
+figure,
+figcaption,
+footer,
+header,
+hgroup,
+menu,
+nav,
+output,
+ruby,
+section,
+summary,
+time,
+mark,
+audio,
+video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+}
+
+/* HTML5 display-role reset for older browsers */
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+ display: block;
+}
+
body {
- font-family: Arial, sans-serif;
- line-height: 1.6;
- margin: 0;
- padding: 0;
+ line-height: 1;
}
-header {
- background: #333;
- color: #fff;
- padding: 1rem 0;
- text-align: center;
-}
-
-header h1 {
- margin: 0;
-}
-
-nav ul {
+ol,
+ul {
list-style: none;
- padding: 0;
}
-nav ul li {
- display: inline;
- margin-right: 1rem;
+blockquote,
+q {
+ quotes: none;
}
-nav ul li a {
- color: #fff;
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+ content: '';
+ content: none;
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+
+
+@property --font-color {
+ syntax: "";
+ inherits: true;
+ initial-value: oklch(25.11% 0.006 258.36);
+}
+
+@property --background-color {
+ syntax: "";
+ inherits: true;
+ initial-value: #F6F0F0;
+}
+
+@property --code-background-color {
+ syntax: "";
+ inherits: true;
+ initial-value: #c7c1c1;
+}
+
+@property --hover-color {
+ syntax: "";
+ inherits: true;
+ initial-value: #A4B465;
+}
+
+@property --url-color {
+ syntax: "";
+ inherits: true;
+ initial-value: #626F47;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ --font-color: oklch(91.87% 0.003 264.54);
+ --background-color: #29261f;
+ --hover-color: #626F47;
+ --url-color: #A4B465;
+ --code-background-color: #3d392e;
+ }
+}
+
+
+
+body {
+ font-family: "Open Sans", sans-serif;
+ font-optical-sizing: auto;
+ font-weight: 400;
+ font-style: normal;
+ font-variation-settings:
+ "wdth" 100;
+ display: flex;
+ justify-content: center;
+ background-color: var(--background-color);
+ color: var(--font-color);
+}
+
+a {
+ color: var(--url-color);
text-decoration: none;
+ transition: all 0.25s ease-in-out;
}
-nav ul li a:hover {
- text-decoration: underline;
+a:hover {
+ color: var(--hover-color);
+ transition: all 0.25s ease-in-out;
}
-main {
- padding: 2rem;
+a:visited {
+ color: #C14600;
+ transition: all 0.25s ease-in-out;
}
-footer {
- background: #333;
- color: #fff;
- text-align: center;
- padding: 1rem 0;
- position: fixed;
- bottom: 0;
- width: 100%;
+a:visited:hover {
+ color: var(--hover-color);
+ transition: all 0.25s ease-in-out;
}
+
+@supports (font-size-adjust: 1) {
+ .content {
+ font-size-adjust: 0.5;
+ }
+}
+
+ul {
+ list-style: square;
+}
+
+li {
+ line-height: 160%;
+ margin-bottom: 0.5rem;
+}
+
+.content {
+ line-height: calc(1ex / 0.32);
+ text-rendering: optimizeLegibility;
+ max-width: 80ch;
+ padding-left: 1rem;
+}
+
+.content h1 {
+ font-size: 2.5em;
+ line-height: calc(1ex / 0.42);
+ margin: calc(1ex / 0.42) 0;
+}
+
+.content h2 {
+ font-size: 2em;
+ line-height: calc(1ex / 0.42);
+ margin: calc(1ex / 0.42) 0;
+}
+
+.content h3 {
+ font-size: 1.75em;
+ line-height: calc(1ex / 0.38);
+ margin: calc(1ex / 0.38) 0;
+}
+
+.content h4 {
+ font-size: 1.5em;
+ line-height: calc(1ex / 0.37);
+ margin: calc(1ex / 0.37) 0;
+}
+
+.content p {
+ font-size: 1em;
+ line-height: calc(1ex / 0.32);
+ margin: calc(1ex / 0.32) 0;
+ text-align: justify;
+ hyphens: auto;
+}
+
+
+.sidebar {
+ padding-top: 4rem;
+ line-height: calc(1ex / 0.32);
+ text-rendering: optimizeLegibility;
+}
+
+.holder {
+ display: flex;
+ flex-direction: row;
+ margin: auto;
+}
\ No newline at end of file
diff --git a/docs/templates/__file.md.html b/docs/templates/__file.md.html
index bad5d05..32d50aa 100644
--- a/docs/templates/__file.md.html
+++ b/docs/templates/__file.md.html
@@ -1,4 +1,7 @@
{{ content|safe }}
-
+
+
+
+
\ No newline at end of file
diff --git a/docs/templates/base.html b/docs/templates/base.html
index 024b756..b429250 100644
--- a/docs/templates/base.html
+++ b/docs/templates/base.html
@@ -1,42 +1,43 @@
+
{{ title }}
+
+
+
+
{% for style in styles %}
-
+
{% endfor %}
+
-
-