Skip to content

Commit 55d6ead

Browse files
authored
Merge pull request #1118 from DocArmoryTech/mkdocs-readme
docs: add mkdocs readme
2 parents e99fe90 + 3e4d327 commit 55d6ead

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

tools/mkdocs/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# MISP Galaxy MkDocs: Setup & Usage
2+
3+
This folder contains the tooling to generate and publish the MISP Galaxy documentation site using MkDocs (Material theme).
4+
5+
The documentation content is generated by `generator.py` from the JSON galaxies and clusters in the repository, then built with MkDocs using the configuration in `site/mkdocs.yml`.
6+
7+
## Prerequisites
8+
- Python 3.10+ recommended (Linux, bash)
9+
- A virtual environment (optional but recommended)
10+
- `pip` for installing dependencies
11+
12+
## Install Dependencies
13+
Run these from `misp-galaxy/tools/mkdocs`:
14+
15+
```bash
16+
# Create and activate a virtual environment (recommended)
17+
python3 -m venv .venv
18+
source .venv/bin/activate
19+
20+
# Install required packages
21+
pip install -r requirements.txt
22+
```
23+
24+
Dependencies include `mkdocs`, `mkdocs-material`, and plugins listed in `requirements.txt`.
25+
26+
## Generate Site Content
27+
The static pages are generated from the Galaxy/Cluster JSON files via `generator.py` and written to `site/docs/`.
28+
29+
```bash
30+
python3 generator.py
31+
```
32+
33+
This will:
34+
- Parse `../../clusters` and `../../galaxies`
35+
- Build relations and statistics
36+
- Write Markdown files under `site/docs/`
37+
38+
## Build the MkDocs Site
39+
MkDocs uses the configuration in `site/mkdocs.yml`.
40+
41+
```bash
42+
cd site
43+
mkdocs build
44+
```
45+
46+
The static site will be generated into `site/site/`.
47+
48+
## Local Preview (Live Server)
49+
To preview locally with auto-reload:
50+
51+
```bash
52+
cd site
53+
mkdocs serve
54+
# Visit http://127.0.0.1:8000
55+
```
56+
57+
Note: Re-run `python3 generator.py` when source JSON changes so `site/docs/` stays up to date.
58+
59+
## One-Step Build Script
60+
The `build.sh` script checks installed packages vs `requirements.txt`, runs the generator, builds the site, and (for maintainers) deploys via `rsync`.
61+
62+
```bash
63+
bash build.sh
64+
```
65+
66+
Deployment via `rsync` requires access to the target host. If you are not a maintainer, you can comment out or remove the `rsync` line in `build.sh`.
67+
68+
## Project Structure
69+
- `generator.py`: Generates Markdown content into `site/docs/`
70+
- `modules/`: Helpers for building the universe, galaxies, clusters, and site pages
71+
- `site/mkdocs.yml`: MkDocs configuration (Material theme, plugins, assets)
72+
- `site/docs/`: Generated documentation content
73+
- `requirements.txt`: Python dependencies for generation and MkDocs
74+
- `build.sh`: Helper script to generate, build, and deploy
75+
76+
## Troubleshooting
77+
- If `mkdocs` is not found, ensure your venv is activated and `mkdocs` is installed: `pip install -r requirements.txt`.
78+
- If content seems outdated, re-run: `python3 generator.py` before `mkdocs serve` or `mkdocs build`.
79+
- If plugin errors occur, verify plugin versions match `requirements.txt` and reinstall.

0 commit comments

Comments
 (0)