Skip to content

Commit f02dc4f

Browse files
committed
Migrate from Sphinx to MkDocs: convert RST to MD, update config and scripts
1 parent 0ec84fa commit f02dc4f

34 files changed

Lines changed: 233 additions & 669 deletions

.github/workflows/build-and-deploy.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ jobs:
3535
python-version: '3.12' # Specify exact version for reproducibility
3636
cache: 'pip'
3737

38-
- name: Cache Sphinx doctrees
39-
uses: actions/cache@v4
40-
with:
41-
path: docs/.doctrees
42-
key: sphinx-doctrees-${{ hashFiles('src/**') }}
43-
restore-keys: |
44-
sphinx-doctrees-
4538

4639
- name: Install dependencies
4740
run: |
@@ -50,8 +43,8 @@ jobs:
5043
5144
- name: Build HTML documentation
5245
run: |
53-
echo "🔨 Building Sphinx documentation..."
54-
sphinx-build -b html -d docs/.doctrees src docs
46+
echo "🔨 Building MkDocs documentation..."
47+
mkdocs build
5548
touch docs/.nojekyll
5649
echo "✅ Build completed!"
5750

README.md

Lines changed: 41 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
# my-sphinx
1+
# Knowledge Utility Kit
22

3-
A project for publishing documentation to GitHub Pages using Sphinx.
3+
A project for publishing documentation to GitHub Pages using **MkDocs** and **Material for MkDocs**.
44

55
## 📁 Project Structure
66

77
```
8-
my-sphinx/
8+
kukgini.github.io/
99
├── .github/
1010
│ └── workflows/
1111
│ └── build-and-deploy.yml # GitHub Actions automated build
1212
├── bin/ # Build tools (for local use)
1313
│ ├── build # Build documentation
1414
│ ├── deploy # Build + Git deployment
1515
│ └── clean # Clean build artifacts
16-
├── src/ # Documentation source files
17-
│ ├── bosh/
18-
│ ├── cf/
19-
│ ├── git/
20-
│ ├── golang/
21-
│ ├── os/
22-
│ ├── md/
23-
│ ├── z-diagrams/
24-
│ ├── conf.py # Sphinx configuration
25-
│ └── index.rst # Documentation main page
16+
├── src/ # Documentation source files (Markdown)
17+
│ ├── ap2/
18+
│ ├── dt/
19+
│ ├── paas/
20+
│ ├── iaas/
21+
│ ├── _static/ # Custom CSS
22+
│ └── index.md # Home page
2623
├── docs/ # Build output (for GitHub Pages deployment)
27-
│ ├── .nojekyll # Disable Jekyll for GitHub Pages
28-
│ ├── index.html # Main HTML page
29-
│ ├── _static/ # Static files (CSS, JS, etc.)
30-
│ └── ... # Other HTML files
24+
├── mkdocs.yml # MkDocs configuration
3125
├── requirements.txt # Python dependencies
3226
└── README.md
3327
```
@@ -36,16 +30,12 @@ my-sphinx/
3630

3731
### 🤖 Automated Build (GitHub Actions)
3832

39-
When you modify and commit source files in the `src/` directory, GitHub Actions will automatically build and deploy the documentation.
33+
When you modify and push source files, GitHub Actions will automatically build and deploy the documentation.
4034

4135
**Trigger conditions:**
4236
- Changes to files in the `src/` directory
4337
- Changes to `requirements.txt`
44-
- Push to `master` or `main` branch
45-
46-
**GitHub Actions execution status:**
47-
- Check execution status in the repository's **Actions** tab
48-
- After build completion, the `docs/` directory is automatically updated
38+
- Push to `main` branch
4939

5040
### 📦 Local Build
5141

@@ -61,9 +51,9 @@ When you modify and commit source files in the `src/` directory, GitHub Actions
6151

6252
**Process:**
6353
1. Create an isolated virtual environment (`.venv`)
64-
2. Install dependencies (`sphinx`, `sphinx_rtd_theme`, `recommonmark`)
65-
3. Build HTML documentation with Sphinx (`src/``docs/`)
66-
4. Create `.nojekyll` file (for GitHub Pages)
54+
2. Install dependencies (`mkdocs`, `mkdocs-material`)
55+
3. Build documentation (`src/``docs/`)
56+
4. Create `.nojekyll` file
6757
5. Automatically clean up virtual environment
6858

6959
Build output is generated in the `docs/` directory.
@@ -80,123 +70,50 @@ Build output is generated in the `docs/` directory.
8070
3. Automatic commit
8171
4. Push to GitHub
8272

83-
> **💡 Tip**: With GitHub Actions, you only need to modify sources and push without building locally!
84-
8573
#### 3. Clean Build Artifacts
8674

8775
```bash
8876
./bin/clean
8977
```
9078

91-
Deletes the `docs/`, `_build/`, and `.venv/` directories.
79+
Deletes the `docs/`, `site/`, and `.venv/` directories.
9280

9381
## 📝 Writing Documentation
9482

9583
### Adding Documents
9684

97-
1. Create a `.rst` or `.md` file in the `src/` directory
98-
2. Add the new document to `src/index.rst`:
99-
100-
```rst
101-
.. toctree::
102-
:maxdepth: 1
103-
104-
your-new-document.md
105-
```
106-
107-
3. Build and deploy:
108-
109-
```bash
110-
./bin/deploy
111-
```
112-
113-
### Supported Formats
114-
115-
- **reStructuredText** (`.rst`): Sphinx default format
116-
- **Markdown** (`.md`): Supported through the `recommonmark` extension
117-
118-
## 🌐 GitHub Pages Setup
119-
120-
### 1. Enable GitHub Pages
121-
122-
1. GitHub repository → **Settings****Pages**
123-
2. **Source**: Deploy from a branch
124-
3. **Branch**: `master` (or `main`)
125-
4. **Folder**: Select `/docs`
126-
5. **Save**
127-
128-
### 2. GitHub Actions Permissions (Important!)
129-
130-
1. GitHub repository → **Settings****Actions****General**
131-
2. In the **Workflow permissions** section:
132-
- Select **Read and write permissions**
133-
- Check **Allow GitHub Actions to create and approve pull requests**
134-
3. **Save**
135-
136-
Without this setting, GitHub Actions cannot commit build results.
137-
138-
### 3. Verify Automated Deployment
85+
1. Create a `.md` file in the `src/` directory.
86+
2. Add the new document to `mkdocs.yml` under `nav`:
13987

140-
Now when you modify and push files in the `src/` directory:
141-
142-
1. **GitHub Actions** automatically executes the build
143-
2. Build results are committed to `docs/`
144-
3. **GitHub Pages** automatically updates
145-
146-
**Check execution:**
147-
- Check workflow execution status in the repository's **Actions** tab
148-
- When complete, the GitHub Pages site automatically updates
149-
150-
## 🛠️ Advanced Usage
151-
152-
### Manual Python Execution
153-
154-
```bash
155-
# Build
156-
python3 bin/build
157-
158-
# Deploy
159-
python3 bin/deploy
160-
161-
# Clean
162-
python3 bin/clean
88+
```yaml
89+
nav:
90+
- Home: index.md
91+
- My Section:
92+
- my-new-doc.md
16393
```
16494
165-
### Complete Rebuild
166-
167-
```bash
168-
./bin/clean
169-
./bin/build
170-
```
171-
172-
### Changing Sphinx Configuration
173-
174-
You can change Sphinx settings by editing the `src/conf.py` file:
175-
176-
- Change theme
177-
- Add extensions
178-
- Modify project metadata
179-
180-
## 📦 Dependencies
181-
182-
The project uses the following Python packages:
183-
184-
- **sphinx**: Documentation generation tool
185-
- **sphinx_rtd_theme**: Read the Docs theme
186-
- **recommonmark**: Markdown support
95+
3. Build and deploy.
18796
188-
Dependencies are automatically installed in an isolated virtual environment during build, so they don't affect your system Python environment.
97+
### Supported Features
18998
190-
## 🔒 Isolated Build Environment
99+
- **Markdown**: Standard Markdown syntax.
100+
- **Admonitions**: `!!! note "Title"` blocks.
101+
- **Code Highlighting**: Fenced code blocks with language specifiers.
102+
- **Mermaid Diagrams**:
103+
```mermaid
104+
graph TD
105+
A[Start] --> B{Is it working?}
106+
B -- Yes --> C[Great!]
107+
B -- No --> D[Debug]
108+
```
191109

192-
All builds run in a temporary virtual environment:
110+
## 🛠️ Configuration
193111

194-
1. Create `.venv` when build starts
195-
2. Install dependencies
196-
3. Build documentation
197-
4. Automatically delete `.venv` after build completes
112+
You can change site settings by editing `mkdocs.yml`:
198113

199-
You can use all necessary build tools while keeping your system Python environment clean.
114+
- Change theme colors
115+
- Add plugins
116+
- Modify navigation structure
200117

201118
## 📄 License
202119

bin/build

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def main():
2424
if sys.platform == "win32":
2525
venv_python = venv_dir / "Scripts" / "python.exe"
2626
venv_pip = venv_dir / "Scripts" / "pip.exe"
27-
venv_sphinx = venv_dir / "Scripts" / "sphinx-build.exe"
27+
venv_mkdocs = venv_dir / "Scripts" / "mkdocs.exe"
2828
else:
2929
venv_python = venv_dir / "bin" / "python"
3030
venv_pip = venv_dir / "bin" / "pip"
31-
venv_sphinx = venv_dir / "bin" / "sphinx-build"
31+
venv_mkdocs = venv_dir / "bin" / "mkdocs"
3232

3333
try:
3434
# Step 1: Create virtual environment
@@ -42,10 +42,8 @@ def main():
4242
# Step 3: Build documentation
4343
print("\n🔨 Building documentation...")
4444
run_command([
45-
str(venv_sphinx),
46-
"-b", "html",
47-
"src",
48-
"docs"
45+
str(venv_mkdocs),
46+
"build"
4947
], cwd=project_root)
5048

5149
# Step 4: Create .nojekyll file for GitHub Pages

mkdocs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
site_name: Knowledge Utility Kit
2+
theme:
3+
name: material
4+
features:
5+
- navigation.tabs
6+
- navigation.sections
7+
- toc.integrate
8+
palette:
9+
- scheme: default
10+
primary: indigo
11+
accent: indigo
12+
toggle:
13+
icon: material/brightness-7
14+
name: Switch to dark mode
15+
- scheme: slate
16+
primary: indigo
17+
accent: indigo
18+
toggle:
19+
icon: material/brightness-4
20+
name: Switch to light mode
21+
22+
docs_dir: src
23+
site_dir: docs
24+
25+
markdown_extensions:
26+
- admonition
27+
- pymdownx.details
28+
- pymdownx.superfences:
29+
custom_fences:
30+
- name: mermaid
31+
class: mermaid
32+
format: !!python/name:pymdownx.superfences.fence_code_format
33+
- pymdownx.highlight:
34+
anchor_linenums: true
35+
- pymdownx.inlinehilite
36+
- pymdownx.snippets
37+
- tables
38+
- attr_list
39+
40+
extra_css:
41+
- _static/custom.css
42+
43+
nav:
44+
- Home: index.md
45+
- Agentic Commerce:
46+
- ap2/ap2-samples.md
47+
- Digital Credential:
48+
- dt/ssi.md
49+
- dt/askar_multitenancy_encryption_ko.md
50+
- dt/askar_rekey_ko.md

requirements.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
sphinx>=7.0.0
2-
sphinx_rtd_theme
3-
sphinx-material>=0.0.36
4-
myst-parser>=2.0.0
5-
sphinx-book-theme>=1.0.0
6-
sphinxcontrib-mermaid>=0.9.0
1+
mkdocs>=1.5.0
2+
mkdocs-material>=9.4.0

0 commit comments

Comments
 (0)