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. 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/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. 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; +}