From ff51c6a5826d4278f74f6a5eaf872df5ac3d7446 Mon Sep 17 00:00:00 2001 From: Itx-Psycho0 Date: Fri, 4 Dec 2026 00:53:31 +0530 Subject: [PATCH 1/3] fix: render Mermaid diagrams on the site The high- and low-level design pages contain five ```mermaid blocks. GitHub draws them, but mdBook printed them as plain code. theme/mermaid-init.js loads Mermaid 11.4.1 from jsDelivr only on pages that have a diagram, turns each block into a diagram and picks Mermaid's dark theme when a dark mdBook theme (navy, coal, ayu) is active. The CSS centres the diagrams and drops the code-block background. --- book.toml | 1 + theme/mermaid-init.js | 24 ++++++++++++++++++++++++ theme/psydian.css | 6 ++++++ 3 files changed, 31 insertions(+) create mode 100644 theme/mermaid-init.js diff --git a/book.toml b/book.toml index cb086c2..9e5507f 100644 --- a/book.toml +++ b/book.toml @@ -16,6 +16,7 @@ site-url = "/docs/" git-repository-url = "https://github.com/PsyDianOS/docs" edit-url-template = "https://github.com/PsyDianOS/docs/edit/main/{path}" additional-css = ["theme/psydian.css"] +additional-js = ["theme/mermaid-init.js"] no-section-label = false [output.html.fold] diff --git a/theme/mermaid-init.js b/theme/mermaid-init.js new file mode 100644 index 0000000..5ce70da --- /dev/null +++ b/theme/mermaid-init.js @@ -0,0 +1,24 @@ +// Renders ```mermaid code blocks as diagrams, the way GitHub does. +// Mermaid is loaded only on pages that contain a diagram, and follows the +// light or dark mdBook theme. +(function () { + const blocks = document.querySelectorAll("code.language-mermaid"); + if (!blocks.length) return; + + const script = document.createElement("script"); + script.src = "https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.min.js"; + script.onload = function () { + blocks.forEach(function (code) { + const diagram = document.createElement("pre"); + diagram.className = "mermaid"; + diagram.textContent = code.textContent; + code.parentElement.replaceWith(diagram); + }); + const dark = ["coal", "navy", "ayu"].some(function (theme) { + return document.documentElement.classList.contains(theme); + }); + mermaid.initialize({ startOnLoad: false, theme: dark ? "dark" : "default" }); + mermaid.run(); + }; + document.head.appendChild(script); +})(); diff --git a/theme/psydian.css b/theme/psydian.css index 030f977..b7c80b0 100644 --- a/theme/psydian.css +++ b/theme/psydian.css @@ -34,3 +34,9 @@ display: table; width: 100%; } + +/* Mermaid diagrams: centred, no code-block background. */ +pre.mermaid { + background: none; + text-align: center; +} From d2922488564bfc34580acde2de3c0b1b367e593a Mon Sep 17 00:00:00 2001 From: Itx-Psycho0 Date: Fri, 4 Dec 2026 00:58:06 +0530 Subject: [PATCH 2/3] docs(project): note that Docs/ moved to this repository The repository structure and README specification pages are the original plans, written when documentation lived in Docs/ inside the code repository. Each page now opens with a note that says so. The repository structure note shows how the organisation is laid out today: code in PsyDian_OS, this book in PsyDianOS/docs. It links the code README for the current source layout. The old plan below the note is kept as written. --- src/project/readme-specification.md | 2 ++ src/project/repository-structure.md | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/project/readme-specification.md b/src/project/readme-specification.md index e31d8a3..b8a2a71 100644 --- a/src/project/readme-specification.md +++ b/src/project/readme-specification.md @@ -1,5 +1,7 @@ # README Specification +> **Note:** this page is the original specification for the code repository's README. Two things have changed since: there is no `Docs/` folder in the code repository any more, and the README's Documentation section links to this book at [psydianos.github.io/docs](https://psydianos.github.io/docs/) instead of to `Docs/...` files. The examples below are kept as they were written. + ## 1. Purpose The root `README.md` is the primary entry point for the PsyDian repository. diff --git a/src/project/repository-structure.md b/src/project/repository-structure.md index 53a0532..1cf0858 100644 --- a/src/project/repository-structure.md +++ b/src/project/repository-structure.md @@ -1,5 +1,14 @@ # GitHub Repository Structure +> **Note:** this page is the original repository plan, written before the code existed. The documentation has since moved out of the code repository into its own repository, so the `Docs/` folder shown below no longer exists. The organisation is now laid out like this: +> +> | Repository | Contents | +> |---|---| +> | [PsyDianOS/PsyDian_OS](https://github.com/PsyDianOS/PsyDian_OS) | `kernel/`, `ai-bridge/`, `scripts/`, `website/`, `src/` (host launcher), `.github/`, README, CONTRIBUTING, SECURITY, licences | +> | [PsyDianOS/docs](https://github.com/PsyDianOS/docs) | This book: `src/` with `product/`, `architecture/`, `reference/`, `engineering/` and `project/`, plus `book.toml` and `theme/` | +> +> For the current layout of the code itself, see the "Repository layout" section of the [PsyDian_OS README](https://github.com/PsyDianOS/PsyDian_OS#repository-layout). + ## 1. Purpose The PsyDian repository should keep source code, documentation, tests, build configuration, scripts, and project artifacts organized so that both team members can understand and reproduce the project. From 5f8862d836c4fe81ff7b10ed156e33bbed4d7806 Mon Sep 17 00:00:00 2001 From: Itx-Psycho0 Date: Fri, 4 Dec 2026 00:58:06 +0530 Subject: [PATCH 3/3] docs(contributing): apply sentence-case headings to new pages only Most existing pages use Title Case headings (about 700 of them). Asking every pull request to follow sentence case would mix formatting into content changes, so the rule now applies to new pages and full rewrites. The pull request checklist says the same. --- .github/pull_request_template.md | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9edfd69..dc20355 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,4 +11,4 @@ - [ ] `mdbook build` runs without errors - [ ] New pages are listed in `src/SUMMARY.md` - [ ] Links between pages are relative (`../reference/protocol-api.md`) -- [ ] Headings use sentence case +- [ ] Headings on new pages use sentence case diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fdcb9b8..f37874d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ For a new page, add the Markdown file to the right section folder under `src/` a ## Style - Write plain, direct English. Short sentences, active voice, explain terms the first time you use them. -- Use sentence case for headings: "High-level design", not "High-Level Design". +- Use sentence case for headings in new pages: "High-level design", not "High-Level Design". Many older pages use Title Case; leave their headings as they are unless you are rewriting the page, so pull requests stay focused on content. - Use relative links between pages, such as `[protocol](../reference/protocol-api.md)`, so they work both on GitHub and on the site. - Put commands, file names and code in backticks, and longer code in fenced blocks with a language (` ```rust `). - When the code and a page disagree, the code is right: update the page in the same pull request as the code change if you can.