Architecture¶
This page describes the internal structure and design of mkdocs-neoabs.
Project Structure¶
mkdocs-neoabs/
├── neoabs/ # Python package
│ ├── __init__.py # Version (0.1.0)
│ ├── plugins/
│ │ └── neoabs_plugin.py # MkDocs plugin
│ ├── templates/
│ │ ├── base.html # Root HTML template
│ │ ├── main.html # Content wrapper
│ │ ├── 404.html # Error page
│ │ ├── mkdocs_theme.yml # Theme registration
│ │ ├── partials/ # Reusable HTML partials
│ │ └── assets/ # CSS, JS, images
│ ├── extensions/ # Reserved
│ └── utilities/ # Reserved
├── docs/ # Documentation source (Markdown)
├── logo/ # Project logo
├── tools/
│ ├── build.js # SCSS → CSS build pipeline
│ └── screenshots_gen.py # Screenshot generator
├── Screenshots/ # Generated screenshots
├── mkdocs.yml # MkDocs site config
├── pyproject.toml # Python package config
├── package.json # Node.js dependencies
└── requirements.txt # Python dependencies
Components¶
Theme Templates¶
The theme is built from Jinja2 templates:
| Template | Purpose |
|---|---|
base.html |
Root HTML skeleton, loads CSS/JS, defines blocks |
main.html |
Extends base, wraps page content |
404.html |
Glass-styled error page |
partials/header.html |
Sticky header with logo, title, search, repo link |
partials/nav.html |
Sidebar navigation with recursive macro |
partials/content.html |
Renders page.content |
partials/toc.html |
Auto-generated table of contents |
partials/footer.html |
Previous/next links and copyright |
partials/palette.html |
Dark/light mode radio toggle |
partials/search.html |
Full-screen search modal |
partials/progress.html |
Reading progress bar |
partials/javascripts/palette.html |
FOUC prevention (inline early-apply) |
Plugin¶
neoabs_plugin.py is a lightweight MkDocs plugin that:
- Sets theme defaults (language, palette, fonts, glass options) if not configured
- Ensures the
neoabskey inthemealways has all required sub-options
It hooks into on_config and modifies the config before templates render.
CSS Architecture¶
The stylesheet is organized in layers:
- Design Tokens — CSS custom properties on
:rootfor colors, spacing, typography, glass, shadows, z-index, transitions - Light Mode Overrides — Token overrides scoped to
[data-md-color-scheme="default"] - Glass Intensity Variants —
light/medium/heavyvia[data-md-neoabs-glass]attribute - Base Resets — Box-sizing, font smoothing, reduced motion
- Dot Matrix Overlay — Radial gradient pattern
- Glass Components —
.neoabs-glass,.neoabs-card - Typography — Display, labels, body, inline code
- Components (
components.scss) — Layout, header, nav, content area, TOC, footer, search, tabs, admonitions, code blocks, tables, scroll utilities, mobile responsive, print styles, MkDocs compatibility
JavaScript¶
neoabs.js is a single vanilla ES6+ file (no dependencies) that handles:
- Theme initialization — Reads saved color scheme from localStorage
- Color scheme toggling — Switches
data-md-color-schemeattribute - Palette icon visibility — Shows only the opposite scheme icon
- Mobile navigation — Drawer open/close with overlay
- Search — Loads search index, performs client-side search, renders results, keyboard navigation
- Table of contents tracking — Intersection Observer for active section highlighting
- Scroll behaviors — Header scroll-aware glass, back-to-top button, reading progress
- Code copy buttons — Clipboard API with feedback
- Anchor link headings — Auto-generated anchor links for headings
- Keyboard shortcuts —
/for search,?for help,Escto close - Help modal — Displays available keyboard shortcuts
- Nav toggle — Expands/collapses navigation sections via CSS class
Build Pipeline¶
tools/build.js compiles SCSS to CSS:
neoabs.scss → sass.compile() → postcss(autoprefixer + cssnano) → neoabs.css
npm run build— Production (compressed, no sourcemaps)npm run dev— Development (expanded, inline sourcemaps)npm run start— Watch mode (rebuilds on SCSS changes via chokidar)
Design Token System¶
All visual properties are defined as CSS custom properties:
:root {
--neoabs-ink: #000000; /* Background */
--neoabs-text-primary: #ffffff; /* Primary text */
--neoabs-accent: #ff3030; /* Nothing Red */
--neoabs-glass-bg: rgba(255, 255, 255, 0.08); /* Glass fill */
--neoabs-glass-blur: 20px; /* Blur radius */
--neoabs-font-display: 'Space Grotesk';
--neoabs-font-mono: 'Space Mono';
/* ... */
}
Override any token in a custom stylesheet to theme the entire site without touching component code.
Data Flow¶
graph TD
A[Markdown Files] --> B[MkDocs]
B --> C[neoabs_plugin.py]
C --> D[HTML Templates]
D --> E[base.html]
E --> F[Header]
E --> G[Nav]
E --> H[Content]
E --> I[TOC]
E --> J[Footer]
E --> K[Search]
E --> L[CSS]
E --> M[JavaScript]
N[SCSS Files] --> O[build.js]
O --> P[neoabs.css]