|
| 1 | +--- |
| 2 | +weight: 100 |
| 3 | +--- |
| 4 | + |
| 5 | +# Documentation Migration Guide: From MkDocs to Doom.js |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This guide provides comprehensive instructions for migrating design documents from the MkDocs-based `specs` repository to the Doom.js-based `tektoncd-operator` documentation system. This migration enables centralized documentation management within the tektoncd-operator project. |
| 10 | + |
| 11 | +## Repository Comparison |
| 12 | + |
| 13 | +### Source Repository (MkDocs-based) |
| 14 | +- **Repository**: `/specs` (gitlab-ce.alauda.cn/devops/specs) |
| 15 | +- **Documentation System**: MkDocs with Material theme |
| 16 | +- **File Format**: Standard Markdown (`.md`) |
| 17 | +- **Build System**: Python-based with pip requirements |
| 18 | +- **Configuration**: `mkdocs.yml` |
| 19 | + |
| 20 | +### Target Repository (Doom.js-based) |
| 21 | +- **Repository**: `/tektoncd-operator` (github.com/alaudadevops/tektoncd-operator) |
| 22 | +- **Documentation System**: Doom.js |
| 23 | +- **File Format**: MDX (`.mdx`) with React components |
| 24 | +- **Build System**: Node.js/Yarn-based |
| 25 | +- **Configuration**: `doom.config.yml` |
| 26 | + |
| 27 | +## Key Differences Between Systems |
| 28 | + |
| 29 | +### 1. File Extensions |
| 30 | +- **MkDocs**: Uses `.md` files |
| 31 | +- **Doom.js**: Uses `.mdx` files (supports JSX components) |
| 32 | + |
| 33 | +### 2. Frontmatter Format |
| 34 | +**MkDocs (specs repository):** |
| 35 | +```yaml |
| 36 | +--- |
| 37 | +created: 2025-09-16 |
| 38 | +title: Pipeline Orchestration and Execution |
| 39 | +tags: |
| 40 | +- connectors |
| 41 | +- pipeline |
| 42 | +- orchestrating-pipelines |
| 43 | +--- |
| 44 | +``` |
| 45 | + |
| 46 | +**Doom.js (tektoncd-operator):** |
| 47 | +```yaml |
| 48 | +--- |
| 49 | +weight: 10 |
| 50 | +sourceSHA: <optional-hash> |
| 51 | +i18n: |
| 52 | + additionalPrompts: <optional-translation-hints> |
| 53 | +--- |
| 54 | +``` |
| 55 | + |
| 56 | +### 3. Admonition Syntax |
| 57 | +**MkDocs Format:** |
| 58 | +```markdown |
| 59 | +!!! tip "Pros" |
| 60 | + - Easy to implement |
| 61 | + - Good user experience |
| 62 | + |
| 63 | +!!! danger "Cons" |
| 64 | + - Complex maintenance |
| 65 | + - Limited scalability |
| 66 | + |
| 67 | +!!! note |
| 68 | + This is a note without title |
| 69 | +``` |
| 70 | + |
| 71 | +**Doom.js Format:** |
| 72 | +```markdown |
| 73 | +:::tip |
| 74 | +Easy to implement and provides good user experience |
| 75 | +::: |
| 76 | + |
| 77 | +:::danger |
| 78 | +Complex maintenance with limited scalability |
| 79 | +::: |
| 80 | + |
| 81 | +:::note |
| 82 | +This is a note without title |
| 83 | +::: |
| 84 | + |
| 85 | +:::details{title="Expandable Section"} |
| 86 | +Content that can be expanded/collapsed |
| 87 | +::: |
| 88 | +``` |
| 89 | + |
| 90 | +### 4. Special Components |
| 91 | +**MkDocs**: Uses Python extensions and plugins |
| 92 | +**Doom.js**: Uses React components like: |
| 93 | +- `<Overview overviewHeaders={[]} />` for auto-generated navigation |
| 94 | +- Custom JSX components for interactive elements |
| 95 | + |
| 96 | +### 5. Build Commands |
| 97 | +**MkDocs:** |
| 98 | +```bash |
| 99 | +# Install dependencies |
| 100 | +pip3 install -r requirements.txt |
| 101 | + |
| 102 | +# Development server |
| 103 | +python3 -m mkdocs serve -s |
| 104 | + |
| 105 | +# Build |
| 106 | +python -m mkdocs build --strict --clean |
| 107 | +``` |
| 108 | + |
| 109 | +**Doom.js:** |
| 110 | +```bash |
| 111 | +# Install dependencies |
| 112 | +yarn install |
| 113 | + |
| 114 | +# Development server |
| 115 | +yarn dev |
| 116 | + |
| 117 | +# Build |
| 118 | +yarn build |
| 119 | + |
| 120 | +# Lint |
| 121 | +yarn lint |
| 122 | +``` |
| 123 | + |
| 124 | +## Migration Steps |
| 125 | + |
| 126 | +### Step 1: Prepare the Target Directory Structure |
| 127 | + |
| 128 | +Design documents should be placed in the appropriate directory within the tektoncd-operator documentation structure: |
| 129 | + |
| 130 | +``` |
| 131 | +docs/en/design/ |
| 132 | +├── index.mdx # Overview of design documents |
| 133 | +├── connector-integration/ # Connector-related designs |
| 134 | +├── pipeline-enhancements/ # Pipeline feature designs |
| 135 | +├── operator-improvements/ # Operator-specific designs |
| 136 | +└── architecture/ # Architecture decision records |
| 137 | +``` |
| 138 | + |
| 139 | +### Step 2: File Migration Process |
| 140 | + |
| 141 | +#### 2.1 Copy and Rename Files |
| 142 | +1. Copy the `.md` file from the specs repository |
| 143 | +2. Rename the extension from `.md` to `.mdx` |
| 144 | +3. Place in the appropriate subdirectory under `docs/en/design/` |
| 145 | + |
| 146 | +#### 2.2 Update Frontmatter |
| 147 | +Transform the MkDocs frontmatter to Doom.js format: |
| 148 | + |
| 149 | +**Before (MkDocs):** |
| 150 | +```yaml |
| 151 | +--- |
| 152 | +created: 2025-09-16 |
| 153 | +title: Pipeline Orchestration and Execution |
| 154 | +tags: |
| 155 | +- connectors |
| 156 | +- pipeline |
| 157 | +- orchestrating-pipelines |
| 158 | +--- |
| 159 | +``` |
| 160 | + |
| 161 | +**After (Doom.js):** |
| 162 | +```yaml |
| 163 | +--- |
| 164 | +weight: 10 |
| 165 | +--- |
| 166 | +``` |
| 167 | + |
| 168 | +#### 2.3 Convert Admonitions |
| 169 | +Replace MkDocs admonition syntax with Doom.js format: |
| 170 | + |
| 171 | +**Search and Replace Patterns:** |
| 172 | + |
| 173 | +| MkDocs Pattern | Doom.js Replacement | |
| 174 | +|----------------|---------------------| |
| 175 | +| `!!! tip "Title"` | `:::tip` | |
| 176 | +| `!!! danger "Title"` | `:::danger` | |
| 177 | +| `!!! note "Title"` | `:::note` | |
| 178 | +| `!!! warning "Title"` | `:::warning` | |
| 179 | +| `!!! note` | `:::note` | |
| 180 | + |
| 181 | +**Example Transformation:** |
| 182 | +```markdown |
| 183 | +<!-- MkDocs format --> |
| 184 | +!!! tip "Pros" |
| 185 | + - Easy to implement |
| 186 | + - Good user experience |
| 187 | + |
| 188 | +<!-- Doom.js format --> |
| 189 | +:::tip |
| 190 | +- Easy to implement |
| 191 | +- Good user experience |
| 192 | +::: |
| 193 | +``` |
| 194 | + |
| 195 | +#### 2.4 Handle Asset References |
| 196 | +Update image and asset references: |
| 197 | + |
| 198 | +1. Copy assets from `specs/docs/features/.../assets/` to `tektoncd-operator/docs/shared/assets/design/` |
| 199 | +2. Update image references in the document: |
| 200 | + ```markdown |
| 201 | + <!-- Before --> |
| 202 | +  |
| 203 | + |
| 204 | + <!-- After --> |
| 205 | +  |
| 206 | + ``` |
| 207 | + |
| 208 | +### Step 3: Content Adaptation |
| 209 | + |
| 210 | +#### 3.1 Review Content Relevance |
| 211 | +- Ensure the design document is relevant to the tektoncd-operator project |
| 212 | +- Update any references to the "platform" to be specific to "Alauda DevOps Pipelines" |
| 213 | +- Remove or adapt content specific to other products if not applicable |
| 214 | + |
| 215 | +#### 3.2 Update Navigation Weight |
| 216 | +Assign appropriate `weight` values in frontmatter to control document ordering: |
| 217 | +- Lower numbers appear first |
| 218 | +- Use increments of 10 (10, 20, 30...) to allow future insertions |
| 219 | +- Group related documents with similar weight ranges |
| 220 | + |
| 221 | +#### 3.3 Add Index Files |
| 222 | +Create `index.mdx` files for directories containing multiple documents: |
| 223 | + |
| 224 | +```mdx |
| 225 | +--- |
| 226 | +weight: 1 |
| 227 | +--- |
| 228 | + |
| 229 | +# Design Documents |
| 230 | + |
| 231 | +<Overview overviewHeaders={[]} /> |
| 232 | +``` |
| 233 | + |
| 234 | +### Step 4: Testing and Validation |
| 235 | + |
| 236 | +#### 4.1 Local Development |
| 237 | +1. Run the development server: |
| 238 | + ```bash |
| 239 | + cd tektoncd-operator |
| 240 | + yarn dev |
| 241 | + ``` |
| 242 | +2. Navigate to the design section and verify: |
| 243 | + - Document renders correctly |
| 244 | + - Images display properly |
| 245 | + - Admonitions render as expected |
| 246 | + - Navigation structure is correct |
| 247 | + |
| 248 | +#### 4.2 Build Verification |
| 249 | +1. Build the documentation: |
| 250 | + ```bash |
| 251 | + yarn build |
| 252 | + ``` |
| 253 | +2. Check for any build errors or warnings |
| 254 | +3. Verify no broken links or missing assets |
| 255 | + |
| 256 | +### Step 5: Configuration Updates |
| 257 | + |
| 258 | +#### 5.1 Update doom.config.yml |
| 259 | +If migrating internal design documents, ensure they're covered by the `internalRoutes` configuration: |
| 260 | + |
| 261 | +```yaml |
| 262 | +internalRoutes: |
| 263 | + - '*/design/**/*' |
| 264 | + - '**/design/**/*' |
| 265 | +``` |
| 266 | +
|
| 267 | +#### 5.2 Navigation Structure |
| 268 | +Design documents will automatically appear in navigation due to the `<Overview />` component in index files. |
| 269 | + |
| 270 | +## Migration Checklist |
| 271 | + |
| 272 | +Use this checklist when migrating each document: |
| 273 | + |
| 274 | +- [ ] File copied and renamed to `.mdx` |
| 275 | +- [ ] Placed in appropriate `docs/en/design/` subdirectory |
| 276 | +- [ ] Frontmatter converted to Doom.js format |
| 277 | +- [ ] `weight` value assigned for navigation ordering |
| 278 | +- [ ] All admonitions converted (`!!!` → `:::`) |
| 279 | +- [ ] Asset files copied to shared assets directory |
| 280 | +- [ ] Image references updated to new paths |
| 281 | +- [ ] Content reviewed for tektoncd-operator relevance |
| 282 | +- [ ] Local development server tested |
| 283 | +- [ ] Build process completed successfully |
| 284 | +- [ ] Navigation structure verified |
| 285 | + |
| 286 | +## Common Issues and Solutions |
| 287 | + |
| 288 | +### Issue: Admonitions Not Rendering |
| 289 | +**Problem**: MkDocs-style admonitions (`!!! tip`) don't render in Doom.js |
| 290 | +**Solution**: Convert all admonitions to Doom.js format (`:::tip`) |
| 291 | + |
| 292 | +### Issue: Images Not Loading |
| 293 | +**Problem**: Relative asset paths from MkDocs don't work in Doom.js |
| 294 | +**Solution**: |
| 295 | +1. Copy assets to `docs/shared/assets/design/` |
| 296 | +2. Update references to use absolute paths starting with `/shared/` |
| 297 | + |
| 298 | +### Issue: Complex Tables |
| 299 | +**Problem**: Some advanced MkDocs table syntax might not render |
| 300 | +**Solution**: Simplify table markup or use standard Markdown tables |
| 301 | + |
| 302 | +### Issue: Build Errors |
| 303 | +**Problem**: Doom.js build fails due to unsupported syntax |
| 304 | +**Solution**: |
| 305 | +1. Check for unescaped JSX characters (`<`, `>`) |
| 306 | +2. Ensure all code blocks are properly fenced |
| 307 | +3. Validate frontmatter YAML syntax |
| 308 | + |
| 309 | +## Best Practices |
| 310 | + |
| 311 | +### 1. Document Organization |
| 312 | +- Group related design documents in subdirectories |
| 313 | +- Use descriptive filenames following kebab-case convention |
| 314 | +- Include date in document title or changelog section |
| 315 | + |
| 316 | +### 2. Asset Management |
| 317 | +- Name assets descriptively |
| 318 | +- Organize assets in subdirectories by feature/topic |
| 319 | +- Use web-optimized formats (PNG, SVG for diagrams) |
| 320 | + |
| 321 | +### 3. Content Quality |
| 322 | +- Maintain consistent heading structure (H1 for title, H2 for major sections) |
| 323 | +- Include changelog section for tracking document evolution |
| 324 | +- Use clear, actionable language in design decisions |
| 325 | + |
| 326 | +### 4. Navigation |
| 327 | +- Assign logical weight values for document ordering |
| 328 | +- Create meaningful directory structures |
| 329 | +- Include overview documents for major sections |
| 330 | + |
| 331 | +## Example Migration |
| 332 | + |
| 333 | +Here's a complete example of migrating a design document: |
| 334 | + |
| 335 | +### Before (MkDocs - specs repository) |
| 336 | +**File**: `docs/features/connector-v2/pipeline-integration/orchestration.md` |
| 337 | + |
| 338 | +```markdown |
| 339 | +--- |
| 340 | +created: 2025-09-16 |
| 341 | +title: Pipeline Orchestration and Execution |
| 342 | +tags: |
| 343 | +- connectors |
| 344 | +- pipeline |
| 345 | +--- |
| 346 | +
|
| 347 | +# Pipeline Orchestration and Execution |
| 348 | +
|
| 349 | +!!! tip "Pros" |
| 350 | + - Easy to implement |
| 351 | + - Good user experience |
| 352 | +
|
| 353 | + |
| 354 | +``` |
| 355 | + |
| 356 | +### After (Doom.js - tektoncd-operator) |
| 357 | +**File**: `docs/en/design/connector-integration/pipeline-orchestration.mdx` |
| 358 | + |
| 359 | +```mdx |
| 360 | +--- |
| 361 | +weight: 20 |
| 362 | +--- |
| 363 | +
|
| 364 | +# Pipeline Orchestration and Execution |
| 365 | +
|
| 366 | +## Changelog |
| 367 | +- 2025-09-16: Initial version migrated from specs repository |
| 368 | +
|
| 369 | +:::tip |
| 370 | +- Easy to implement |
| 371 | +- Good user experience |
| 372 | +::: |
| 373 | +
|
| 374 | + |
| 375 | +``` |
| 376 | + |
| 377 | +## Conclusion |
| 378 | + |
| 379 | +This migration process enables centralized documentation management within the tektoncd-operator project while maintaining the rich formatting capabilities needed for technical design documents. Following these guidelines ensures consistency and maintainability of the documentation ecosystem. |
| 380 | + |
| 381 | +For questions or issues during migration, refer to the [Doom.js documentation](https://doom.alauda.io) or consult the development team. |
0 commit comments