com.wallstop-studios.dxmessaging 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.artifacts/SourceGenerators.Tests/obj/Debug/net9.0/WallstopStudios.DxMessaging.SourceGenerators.Tests.AssemblyInfo.cs +1 -1
  2. package/.cspell.json +4 -1
  3. package/.github/workflows/actionlint.yml +11 -1
  4. package/.github/workflows/csharpier-autofix.yml +34 -3
  5. package/.github/workflows/dotnet-tests.yml +13 -0
  6. package/.github/workflows/format-on-demand.yml +38 -44
  7. package/.github/workflows/json-format-check.yml +24 -0
  8. package/.github/workflows/lint-doc-links.yml +13 -0
  9. package/.github/workflows/markdown-json.yml +21 -4
  10. package/.github/workflows/markdown-link-text-check.yml +10 -0
  11. package/.github/workflows/markdown-link-validity.yml +10 -0
  12. package/.github/workflows/markdownlint.yml +7 -5
  13. package/.github/workflows/prettier-autofix.yml +67 -11
  14. package/.github/workflows/release-drafter.yml +2 -2
  15. package/.github/workflows/sync-wiki.yml +3 -3
  16. package/.github/workflows/yaml-format-lint.yml +26 -0
  17. package/.llm/context.md +113 -3
  18. package/.llm/skills/documentation/changelog-management.md +38 -0
  19. package/.llm/skills/documentation/documentation-style-guide.md +18 -0
  20. package/.llm/skills/documentation/documentation-update-workflow.md +2 -0
  21. package/.llm/skills/documentation/documentation-updates.md +2 -0
  22. package/.llm/skills/documentation/markdown-compatibility.md +476 -0
  23. package/.llm/skills/documentation/mermaid-theming.md +326 -0
  24. package/.llm/skills/documentation/mkdocs-navigation.md +290 -0
  25. package/.llm/skills/github-actions/git-renormalize-patterns.md +231 -0
  26. package/.llm/skills/github-actions/workflow-consistency.md +346 -0
  27. package/.llm/skills/index.md +53 -27
  28. package/.llm/skills/scripting/javascript-code-quality.md +417 -0
  29. package/.llm/skills/scripting/regex-documentation.md +461 -0
  30. package/.llm/skills/scripting/shell-best-practices.md +55 -4
  31. package/.llm/skills/scripting/validation-patterns.md +418 -0
  32. package/.llm/skills/specification.md +4 -1
  33. package/.llm/skills/testing/test-code-quality.md +243 -0
  34. package/.llm/skills/testing/test-production-code.md +348 -0
  35. package/CHANGELOG.md +11 -0
  36. package/README.md +0 -11
  37. package/Tests/Runtime/Benchmarks/WallstopStudios.DxMessaging.Tests.Runtime.Benchmarks.asmdef +1 -6
  38. package/Tests/Runtime/Integrations/Reflex/WallstopStudios.DxMessaging.Tests.Runtime.Reflex.asmdef +1 -1
  39. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.DxMessaging.Tests.Runtime.VContainer.asmdef +1 -1
  40. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.DxMessaging.Tests.Runtime.Zenject.asmdef +1 -1
  41. package/coverage/clover.xml +216 -3
  42. package/coverage/clover.xml.meta +7 -7
  43. package/coverage/coverage-final.json +2 -1
  44. package/coverage/coverage-final.json.meta +7 -7
  45. package/coverage/lcov-report/base.css.meta +1 -1
  46. package/coverage/lcov-report/block-navigation.js.meta +1 -1
  47. package/coverage/lcov-report/favicon.png.meta +1 -1
  48. package/coverage/lcov-report/index.html +25 -10
  49. package/coverage/lcov-report/index.html.meta +7 -7
  50. package/coverage/lcov-report/prettify.css.meta +1 -1
  51. package/coverage/lcov-report/prettify.js.meta +1 -1
  52. package/coverage/lcov-report/sort-arrow-sprite.png.meta +1 -1
  53. package/coverage/lcov-report/sorter.js.meta +1 -1
  54. package/coverage/lcov-report/transform-docs-to-wiki.js.html +1 -1
  55. package/coverage/lcov-report/transform-docs-to-wiki.js.html.meta +7 -7
  56. package/coverage/lcov-report/vendor.meta +1 -1
  57. package/coverage/lcov-report.meta +8 -8
  58. package/coverage/lcov.info +365 -0
  59. package/coverage/lcov.info.meta +7 -7
  60. package/docs/architecture/design-and-architecture.md +0 -1
  61. package/docs/concepts/index.md +37 -0
  62. package/docs/concepts/index.md.meta +7 -0
  63. package/docs/concepts/interceptors-and-ordering.md +0 -2
  64. package/docs/concepts/mental-model.md +390 -0
  65. package/docs/concepts/mental-model.md.meta +7 -0
  66. package/docs/concepts/message-types.md +0 -1
  67. package/docs/getting-started/getting-started.md +1 -0
  68. package/docs/getting-started/index.md +6 -5
  69. package/docs/getting-started/overview.md +1 -0
  70. package/docs/getting-started/quick-start.md +2 -1
  71. package/docs/getting-started/visual-guide.md +4 -10
  72. package/docs/hooks.py +10 -1
  73. package/docs/images/DxMessaging-banner.svg +1 -1
  74. package/docs/index.md +7 -7
  75. package/docs/javascripts/mermaid-config.js +44 -4
  76. package/docs/reference/helpers.md +130 -154
  77. package/docs/reference/quick-reference.md +5 -1
  78. package/docs/reference/reference.md +124 -130
  79. package/mkdocs.yml +2 -0
  80. package/package.json +1 -1
  81. package/scripts/__tests__/generate-skills-index.test.js +397 -0
  82. package/scripts/__tests__/generate-skills-index.test.js.meta +7 -0
  83. package/scripts/__tests__/mermaid-config.test.js +467 -0
  84. package/scripts/__tests__/mermaid-config.test.js.meta +7 -0
  85. package/scripts/__tests__/validate-skills-optional-fields.test.js +1474 -0
  86. package/scripts/__tests__/validate-skills-optional-fields.test.js.meta +7 -0
  87. package/scripts/__tests__/validate-skills-required-fields.test.js +188 -0
  88. package/scripts/__tests__/validate-skills-required-fields.test.js.meta +7 -0
  89. package/scripts/__tests__/validate-skills-tags.test.js +353 -0
  90. package/scripts/__tests__/validate-skills-tags.test.js.meta +7 -0
  91. package/scripts/__tests__/validate-workflows.test.js +188 -0
  92. package/scripts/__tests__/validate-workflows.test.js.meta +7 -0
  93. package/scripts/generate-skills-index.js +88 -3
  94. package/scripts/validate-skills.js +230 -30
  95. package/scripts/validate-workflows.js +272 -0
  96. package/scripts/validate-workflows.js.meta +7 -0
  97. package/site/404.html +1 -1
  98. package/site/advanced/emit-shorthands/index.html +2 -2
  99. package/site/advanced/message-bus-providers/index.html +2 -2
  100. package/site/advanced/registration-builders/index.html +2 -2
  101. package/site/advanced/runtime-configuration/index.html +2 -2
  102. package/site/advanced/string-messages/index.html +2 -2
  103. package/site/advanced.meta +1 -1
  104. package/site/architecture/comparisons/index.html +2 -2
  105. package/site/architecture/design-and-architecture/index.html +2 -2
  106. package/site/architecture/performance/index.html +1 -1
  107. package/site/architecture.meta +1 -1
  108. package/site/concepts/index.html +1 -0
  109. package/site/concepts/index.html.meta +7 -0
  110. package/site/concepts/interceptors-and-ordering/index.html +4 -4
  111. package/site/concepts/listening-patterns/index.html +2 -2
  112. package/site/concepts/mental-model/index.html +146 -0
  113. package/site/concepts/mental-model/index.html.meta +7 -0
  114. package/site/concepts/mental-model.meta +8 -0
  115. package/site/concepts/message-types/index.html +2 -2
  116. package/site/concepts/targeting-and-context/index.html +2 -2
  117. package/site/concepts.meta +1 -1
  118. package/site/examples/end-to-end/index.html +2 -2
  119. package/site/examples/end-to-end-scene-transitions/index.html +2 -2
  120. package/site/examples.meta +1 -1
  121. package/site/getting-started/getting-started/index.html +3 -3
  122. package/site/getting-started/index.html +4 -4
  123. package/site/getting-started/install/index.html +3 -3
  124. package/site/getting-started/overview/index.html +2 -2
  125. package/site/getting-started/quick-start/index.html +2 -2
  126. package/site/getting-started/visual-guide/index.html +11 -11
  127. package/site/getting-started.meta +1 -1
  128. package/site/guides/advanced/index.html +2 -2
  129. package/site/guides/diagnostics/index.html +2 -2
  130. package/site/guides/migration-guide/index.html +2 -2
  131. package/site/guides/patterns/index.html +2 -2
  132. package/site/guides/testing/index.html +2 -2
  133. package/site/guides/unity-integration/index.html +2 -2
  134. package/site/guides.meta +1 -1
  135. package/site/hooks.py.meta +1 -1
  136. package/site/images/DxMessaging-banner.svg +119 -0
  137. package/site/images/DxMessaging-banner.svg.meta +7 -0
  138. package/site/images.meta +8 -0
  139. package/site/index.html +2 -2
  140. package/site/integrations/index.html +2 -2
  141. package/site/integrations/reflex/index.html +2 -2
  142. package/site/integrations/vcontainer/index.html +2 -2
  143. package/site/integrations/zenject/index.html +2 -2
  144. package/site/integrations.meta +1 -1
  145. package/site/javascripts/csharp-highlight.js.meta +7 -7
  146. package/site/javascripts/mermaid-config.js +4 -1
  147. package/site/javascripts/mermaid-config.js.meta +1 -1
  148. package/site/javascripts.meta +1 -1
  149. package/site/reference/compatibility/index.html +1 -1
  150. package/site/reference/faq/index.html +1 -1
  151. package/site/reference/glossary/index.html +2 -2
  152. package/site/reference/helpers/index.html +15 -15
  153. package/site/reference/quick-reference/index.html +3 -3
  154. package/site/reference/reference/index.html +37 -37
  155. package/site/reference/troubleshooting/index.html +1 -1
  156. package/site/reference.meta +1 -1
  157. package/site/search/search_index.json +1 -1
  158. package/site/sitemap.xml +46 -38
  159. package/site/sitemap.xml.gz +0 -0
  160. package/site/stylesheets/extra.css.meta +1 -1
  161. package/site/stylesheets.meta +1 -1
@@ -0,0 +1,326 @@
1
+ ---
2
+ title: "Mermaid Diagram Theming"
3
+ id: "mermaid-theming"
4
+ category: "documentation"
5
+ version: "1.1.0"
6
+ created: "2026-01-29"
7
+ updated: "2026-01-29"
8
+
9
+ source:
10
+ repository: "wallstop/DxMessaging"
11
+ files:
12
+ - path: "docs/javascripts/mermaid-config.js"
13
+ - path: "docs/"
14
+ - path: "README.md"
15
+ - path: "Samples~/"
16
+ url: "https://github.com/wallstop/DxMessaging"
17
+ note: "Guidance applies to ALL markdown files in the repository"
18
+
19
+ tags:
20
+ - "documentation"
21
+ - "mermaid"
22
+ - "theming"
23
+ - "mkdocs"
24
+ - "diagrams"
25
+
26
+ complexity:
27
+ level: "intermediate"
28
+ reasoning: "Requires understanding of Mermaid theming and MkDocs Material's theme switching"
29
+
30
+ impact:
31
+ performance:
32
+ rating: "none"
33
+ details: "Documentation only"
34
+ maintainability:
35
+ rating: "high"
36
+ details: "Ensures diagrams render correctly in both light and dark themes"
37
+ testability:
38
+ rating: "none"
39
+ details: "Documentation does not affect testability"
40
+
41
+ prerequisites:
42
+ - "Understanding of Mermaid diagrams"
43
+ - "Understanding of MkDocs Material themes"
44
+
45
+ dependencies:
46
+ packages: []
47
+ skills:
48
+ - "markdown-compatibility"
49
+ - "documentation-style-guide"
50
+
51
+ applies_to:
52
+ languages:
53
+ - "Markdown"
54
+ frameworks:
55
+ - "MkDocs"
56
+ - "Mermaid"
57
+
58
+ aliases:
59
+ - "Diagram theming"
60
+ - "Mermaid dark mode"
61
+ - "Theme switching diagrams"
62
+
63
+ related:
64
+ - "markdown-compatibility"
65
+ - "documentation-style-guide"
66
+
67
+ status: "stable"
68
+ ---
69
+
70
+ # Mermaid Diagram Theming
71
+
72
+ > **One-line summary**: Never use `%%{init: {'theme': '...'}}%%` directives in any markdown file; let renderers (GitHub, VS Code, MkDocs) automatically detect user theme preferences.
73
+
74
+ ## Overview
75
+
76
+ This project uses Mermaid diagrams for visualizing architecture and message flows. Theming must be handled correctly to support both light and dark modes in MkDocs Material.
77
+
78
+ ## Critical: Never Hardcode Dark Themes
79
+
80
+ > **⚠️ NEVER use `%%{init: {'theme': 'dark'}}%%` in ANY markdown file** - not in `docs/`, not in `README.md`, nowhere.
81
+
82
+ ### Why This Matters
83
+
84
+ GitHub and VS Code now respect `prefers-color-scheme` automatically for Mermaid diagrams. Hardcoding `'theme': 'dark'` causes these problems:
85
+
86
+ 1. **Breaks light-mode users**: Users with light theme preferences see dark-themed diagrams with poor contrast
87
+ 1. **Ignores user preferences**: Modern renderers detect system/browser theme automatically
88
+ 1. **Creates inconsistency**: Some diagrams follow user theme, others don't
89
+ 1. **Reduces accessibility**: Low contrast combinations harm users with visual impairments
90
+
91
+ ### The Solution
92
+
93
+ **Omit init directives entirely.** Let the renderer (GitHub, VS Code, MkDocs) choose the appropriate theme based on user preferences.
94
+
95
+ ````markdown
96
+ <!-- ✅ CORRECT: No init directive -->
97
+
98
+ ```mermaid
99
+ flowchart TD
100
+ A[Start] --> B[Process]
101
+ B --> C[End]
102
+ ```
103
+ ````
104
+
105
+ ````markdown
106
+ <!-- ❌ FORBIDDEN: Hardcoded dark theme -->
107
+
108
+ ```mermaid
109
+ %%{init: {'theme': 'dark'}}%%
110
+ flowchart TD
111
+ A[Start] --> B[Process]
112
+ ```
113
+ ````
114
+
115
+ ## The Problem
116
+
117
+ Mermaid supports per-diagram theme configuration via init directives:
118
+
119
+ ```mermaid
120
+ %%{init: {'theme': 'dark'}}%%
121
+ flowchart TD
122
+ A --> B
123
+ ```
124
+
125
+ While this works for static rendering (GitHub, VS Code), it creates a critical issue in MkDocs Material:
126
+
127
+ 1. **MkDocs Material has dynamic theme switching** - Users can toggle between light and dark modes
128
+ 1. **Per-diagram directives override global configuration** - The `mermaid-config.js` script manages theme switching, but init directives bypass it completely
129
+ 1. **Result**: Diagrams with hardcoded `'theme': 'dark'` render incorrectly in light mode (poor contrast, unreadable text)
130
+
131
+ ## docs/ Files vs README.md
132
+
133
+ The same rule applies to ALL markdown files: **omit init directives entirely**.
134
+
135
+ | Location | Viewer | Theming Approach |
136
+ | ----------- | --------------- | -------------------------------------------------------------- |
137
+ | `docs/` | MkDocs Material | **No per-diagram directives** - use global `mermaid-config.js` |
138
+ | `README.md` | GitHub/VS Code | **No per-diagram directives** - rely on automatic theming |
139
+ | Any `.md` | Any renderer | **No per-diagram directives** - let renderer choose theme |
140
+
141
+ ### Why automatic theming is preferred everywhere
142
+
143
+ - **MkDocs Material** dynamically loads `mermaid-config.js` which detects theme changes and re-renders diagrams with appropriate colors. Per-diagram directives interfere with this.
144
+ - **GitHub** automatically respects `prefers-color-scheme` and renders diagrams in the user's preferred theme. Hardcoded themes override this.
145
+ - **VS Code** preview respects the editor's color theme. Hardcoded dark themes look poor in light-themed editors.
146
+
147
+ ## How Global Theming Works
148
+
149
+ The `docs/javascripts/mermaid-config.js` script:
150
+
151
+ 1. Detects the current MkDocs Material theme (`data-md-color-scheme` attribute)
152
+ 1. Initializes Mermaid with semantic color variables for light or dark mode
153
+ 1. Observes theme changes and re-renders all diagrams
154
+ 1. **Strips any `%%{init:...}%%` directives** from diagram source before rendering (as a safety net)
155
+
156
+ This ensures diagrams always match the user's preferred theme.
157
+
158
+ ## Solution
159
+
160
+ ### ✅ Correct: docs/ Files (MkDocs)
161
+
162
+ ````markdown
163
+ ```mermaid
164
+ flowchart TD
165
+ A[Start] --> B[Process]
166
+ B --> C[End]
167
+ ```
168
+ ````
169
+
170
+ No init directive needed. The global configuration handles theming automatically.
171
+
172
+ ### ✅ Correct: README.md (GitHub/VS Code)
173
+
174
+ ````markdown
175
+ ```mermaid
176
+ flowchart TD
177
+ A[Start] --> B[Process]
178
+ B --> C[End]
179
+ ```
180
+ ````
181
+
182
+ No init directive needed. GitHub and VS Code automatically detect user theme preferences.
183
+
184
+ ### ❌ Forbidden: Any File with Hardcoded Theme Directive
185
+
186
+ ````markdown
187
+ ```mermaid
188
+ %%{init: {'theme': 'dark'}}%%
189
+ flowchart TD
190
+ A[Start] --> B[Process]
191
+ ```
192
+ ````
193
+
194
+ This bypasses automatic theme detection and causes poor rendering for users with different theme preferences. Never use `'theme': 'dark'`, `'theme': 'forest'`, or any hardcoded theme value.
195
+
196
+ ## Inline Style Directives
197
+
198
+ Mermaid also supports inline `style` directives for individual nodes:
199
+
200
+ ```mermaid
201
+ flowchart TD
202
+ A[Start] --> B[Process]
203
+ style B fill:#1e3a5f,stroke:#90caf9,stroke-width:2px,color:#e0e0e0
204
+ ```
205
+
206
+ ### The Problem with Hardcoded Colors
207
+
208
+ Inline style directives with hardcoded hex colors (e.g., `fill:#1e3a5f,color:#e0e0e0`) are designed for dark backgrounds. In light mode, these create:
209
+
210
+ - **Poor contrast**: Dark fill colors blend into light backgrounds
211
+ - **Illegible text**: Light text colors become invisible on light backgrounds
212
+ - **Inconsistent appearance**: Some nodes follow theme, others don't
213
+
214
+ ### Recommendations
215
+
216
+ 1. **Prefer no inline styles**: Let the global theme configuration handle all colors
217
+ 1. **Use semantic class names** when custom styling is needed (if supported by renderer)
218
+ 1. **If inline styles are unavoidable**: Document the trade-off and ensure adequate contrast in both themes
219
+
220
+ > **Note**: Unlike init directives, inline style directives cannot be automatically stripped by the mermaid-config.js script. Exercise caution when adding custom node styles.
221
+
222
+ ## Validation
223
+
224
+ Check for forbidden per-diagram theme directives in ALL markdown files:
225
+
226
+ ```bash
227
+ # Find Mermaid theme directives in ALL markdown files
228
+ grep -rn --include='*.md' "%%{init.*theme" .
229
+ ```
230
+
231
+ A successful validation produces no output. If any matches appear (showing filename, line number, and the offending directive), remove the `%%{init: {'theme': '...'}}%%` line from each matching diagram.
232
+
233
+ ### Additional validation for README.md
234
+
235
+ ```bash
236
+ # Specifically check README.md
237
+ grep -n "%%{init" README.md
238
+ ```
239
+
240
+ ## The mermaid-config.js Script
241
+
242
+ The script in `docs/javascripts/mermaid-config.js` provides:
243
+
244
+ ### Light Theme Colors
245
+
246
+ Semantic colors optimized for white/light backgrounds:
247
+
248
+ - **Primary**: Blue (`#e3f2fd` background, `#1565c0` text)
249
+ - **Secondary**: Green (`#e8f5e9` background, `#2e7d32` text)
250
+ - **Tertiary**: Orange (`#fff3e0` background, `#c43e00` text)
251
+ - **Quaternary**: Red (`#ffebee` background, `#b71c1c` text)
252
+ - **Quinary**: Purple (`#f3e5f5` background, `#4a148c` text)
253
+
254
+ ### Dark Theme Colors
255
+
256
+ Semantic colors optimized for dark backgrounds:
257
+
258
+ - **Primary**: Blue (`#1e3a5f` background, `#90caf9` text)
259
+ - **Secondary**: Green (`#1b3d2e` background, `#81c784` text)
260
+ - **Tertiary**: Orange (`#3d2e1a` background, `#ffb74d` text)
261
+ - **Quaternary**: Red (`#3d1a1a` background, `#ef9a9a` text)
262
+ - **Quinary**: Purple (`#2d1f3d` background, `#ce93d8` text)
263
+
264
+ ### Theme Detection
265
+
266
+ The script detects the current theme by checking the `data-md-color-scheme` attribute on the body element:
267
+
268
+ ```javascript
269
+ function isDarkTheme() {
270
+ const scheme = document.body.getAttribute("data-md-color-scheme");
271
+ return scheme === "slate";
272
+ }
273
+ ```
274
+
275
+ ### Init Directive Stripping
276
+
277
+ As a safety net, the script strips per-diagram init directives before rendering:
278
+
279
+ ```javascript
280
+ // Matches %%{init:...}%% directives (gims: global, case-insensitive, multiline, dotAll)
281
+ // Uses [ \t]* for spaces/tabs only (not \s* which includes newlines) to preserve line separation
282
+ const INIT_DIRECTIVE_PATTERN = /^[ \t]*%%\{init:.*?\}%%[ \t]*\r?\n?/gims;
283
+
284
+ function stripInitDirectives(source) {
285
+ return source.replace(INIT_DIRECTIVE_PATTERN, "");
286
+ }
287
+ ```
288
+
289
+ The regex uses four flags: `g` (global) replaces all occurrences, `i` (case-insensitive) matches regardless of case, `m` (multiline) makes `^` match the start of each line, and `s` (dotAll) allows `.*?` to match newlines in multi-line directives. We use `[ \t]*` instead of `\s*` around the directive to avoid consuming newlines, which would concatenate adjacent diagram lines and break Mermaid syntax. The optional `\r?\n?` at the end consumes just the line ending of the directive line itself.
290
+
291
+ ## Common Mistakes
292
+
293
+ ### Using Init Directives in docs/
294
+
295
+ ````markdown
296
+ <!-- ❌ WRONG: This bypasses theme switching -->
297
+
298
+ ```mermaid
299
+ %%{init: {'theme': 'dark'}}%%
300
+ flowchart TD
301
+ A --> B
302
+ ```
303
+ ````
304
+
305
+ The `%%{init: {'theme': 'dark'}}%%` directive overrides the automatic theme detection. Remove this line entirely to allow the mermaid-config.js script to handle theming dynamically.
306
+
307
+ ### Forgetting to Check After Adding Diagrams
308
+
309
+ After adding new Mermaid diagrams, always run the validation command to ensure no init directives were accidentally included.
310
+
311
+ ## See Also
312
+
313
+ - [Markdown Compatibility Guidelines](markdown-compatibility.md) - Full list of forbidden MkDocs-specific syntax
314
+ - [Documentation Style Guide](documentation-style-guide.md) - General documentation standards and formatting conventions
315
+
316
+ ## References
317
+
318
+ - [Mermaid Theming Documentation](https://mermaid.js.org/config/theming.html)
319
+ - [MkDocs Material Theme Switching](https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/)
320
+
321
+ ## Changelog
322
+
323
+ | Version | Date | Changes |
324
+ | ------- | ---------- | ------------------------------------------------------------------------ |
325
+ | 1.1.0 | 2026-01-29 | Added critical guidance against hardcoded themes; updated README.md rule |
326
+ | 1.0.0 | 2026-01-29 | Extracted from markdown-compatibility.md |
@@ -0,0 +1,290 @@
1
+ ---
2
+ title: "MkDocs Navigation Management"
3
+ id: "mkdocs-navigation"
4
+ category: "documentation"
5
+ version: "1.0.0"
6
+ created: "2026-01-29"
7
+ updated: "2026-01-29"
8
+
9
+ source:
10
+ repository: "wallstop/DxMessaging"
11
+ files:
12
+ - path: "mkdocs.yml"
13
+ - path: "docs/"
14
+ url: "https://github.com/wallstop/DxMessaging"
15
+
16
+ tags:
17
+ - "documentation"
18
+ - "mkdocs"
19
+ - "navigation"
20
+ - "site-structure"
21
+ - "yaml"
22
+
23
+ complexity:
24
+ level: "basic"
25
+ reasoning: "Simple YAML structure updates following established patterns"
26
+
27
+ impact:
28
+ performance:
29
+ rating: "none"
30
+ details: "Documentation only"
31
+ maintainability:
32
+ rating: "high"
33
+ details: "Proper navigation ensures all documentation is discoverable"
34
+ testability:
35
+ rating: "none"
36
+ details: "Documentation does not affect testability"
37
+
38
+ prerequisites:
39
+ - "Basic YAML syntax"
40
+ - "Understanding of MkDocs site structure"
41
+
42
+ dependencies:
43
+ packages: []
44
+ skills:
45
+ - "documentation-updates"
46
+ - "documentation-update-workflow"
47
+ - "markdown-compatibility"
48
+
49
+ applies_to:
50
+ languages:
51
+ - "YAML"
52
+ - "Markdown"
53
+ frameworks:
54
+ - "MkDocs"
55
+ - "Material for MkDocs"
56
+
57
+ aliases:
58
+ - "MkDocs nav"
59
+ - "Documentation navigation"
60
+ - "Site structure"
61
+ - "Nav synchronization"
62
+
63
+ related:
64
+ - "documentation-updates"
65
+ - "documentation-update-workflow"
66
+ - "markdown-compatibility"
67
+
68
+ status: "stable"
69
+ ---
70
+
71
+ # MkDocs Navigation Management
72
+
73
+ > **One-line summary**: Always update mkdocs.yml navigation when adding, renaming, or removing documentation pages.
74
+
75
+ ## Overview
76
+
77
+ The `mkdocs.yml` file contains a `nav` section that defines the documentation site's navigation structure. When documentation files are added to the `docs/` directory but not added to the `nav` section, they become "orphaned"—the files exist but are not discoverable through the sidebar navigation.
78
+
79
+ This skill ensures that navigation stays synchronized with the actual documentation files.
80
+
81
+ ## Problem Statement
82
+
83
+ Orphaned documentation pages occur when:
84
+
85
+ - New markdown files are added to `docs/` without updating `mkdocs.yml`
86
+ - Subdirectories get new files but only some are added to nav
87
+ - Files are renamed in `docs/` but nav references the old names
88
+ - Files are deleted from `docs/` but remain in nav (causing broken links)
89
+
90
+ Users cannot find orphaned pages through normal navigation. They appear in search results but seem disconnected from the documentation structure.
91
+
92
+ ## Solution
93
+
94
+ ### Core Rule
95
+
96
+ #### Every documentation file in `docs/` must have a corresponding entry in `mkdocs.yml` nav
97
+
98
+ When you add, rename, or remove any `.md` file in `docs/`, you must make a corresponding update to the `nav` section in `mkdocs.yml`.
99
+
100
+ ### Navigation Structure Patterns
101
+
102
+ The nav section uses a hierarchical YAML structure:
103
+
104
+ ```yaml
105
+ nav:
106
+ - Home: index.md
107
+ - Section Name:
108
+ - section/index.md # Clickable section header
109
+ - Page Title: section/page.md # Named page
110
+ - Another Page: section/another.md
111
+ ```
112
+
113
+ ### Index Pages for Clickable Section Headers
114
+
115
+ When a section has an `index.md` file, list it **without a title** to make the section header itself clickable:
116
+
117
+ ```yaml
118
+ # ✅ CORRECT: Section header is clickable, links to index.md
119
+ nav:
120
+ - Getting Started:
121
+ - getting-started/index.md # No title = clickable header
122
+ - Installation: getting-started/install.md
123
+ - Quick Start: getting-started/quick-start.md
124
+ ```
125
+
126
+ ```yaml
127
+ # ❌ WRONG: Section header is not clickable, index appears as separate item
128
+ nav:
129
+ - Getting Started:
130
+ - Overview: getting-started/index.md # Title makes it a separate item
131
+ - Installation: getting-started/install.md
132
+ ```
133
+
134
+ ### Logical Learning Progression
135
+
136
+ Order pages within sections to follow a natural learning progression:
137
+
138
+ 1. **Overview/Introduction** (index.md) - What is this section about?
139
+ 1. **Core concepts** - Fundamental ideas needed first
140
+ 1. **Practical guides** - How to do common tasks
141
+ 1. **Advanced topics** - Complex scenarios
142
+ 1. **Reference material** - Lookup information
143
+
144
+ Example progression for a Concepts section:
145
+
146
+ ```yaml
147
+ nav:
148
+ - Concepts:
149
+ - concepts/index.md # What are the core concepts?
150
+ - Mental Model: concepts/mental-model.md # High-level understanding
151
+ - Message Types: concepts/message-types.md # Basic building blocks
152
+ - Listening Patterns: concepts/listening-patterns.md # How to receive
153
+ - Targeting & Context: concepts/targeting-and-context.md # Where messages go
154
+ - Interceptors: concepts/interceptors.md # Advanced modification
155
+ ```
156
+
157
+ ## Verification Checklist
158
+
159
+ When adding documentation:
160
+
161
+ - [ ] New `.md` file created in appropriate `docs/` subdirectory
162
+ - [ ] Corresponding entry added to `mkdocs.yml` nav section
163
+ - [ ] If section index, listed without title for clickable header
164
+ - [ ] Placed in logical learning order within section
165
+ - [ ] All sibling files in same directory are also in nav
166
+
167
+ When renaming documentation:
168
+
169
+ - [ ] File renamed in `docs/`
170
+ - [ ] Path updated in `mkdocs.yml` nav
171
+ - [ ] Internal links updated in other documentation files
172
+
173
+ When removing documentation:
174
+
175
+ - [ ] File deleted from `docs/`
176
+ - [ ] Entry removed from `mkdocs.yml` nav
177
+ - [ ] Links from other pages removed or redirected
178
+
179
+ ## Synchronization Verification
180
+
181
+ After making changes, verify all files in a docs subdirectory are in navigation:
182
+
183
+ ```bash
184
+ # List all markdown files in a subdirectory
185
+ ls docs/concepts/*.md
186
+
187
+ # Compare against nav section in mkdocs.yml
188
+ grep -A 20 "Concepts:" mkdocs.yml
189
+ ```
190
+
191
+ Every file from the `ls` command should appear in the nav output.
192
+
193
+ ### Complete Subdirectory Audit Script
194
+
195
+ ```bash
196
+ # Check all docs subdirectories for orphaned files
197
+ for dir in docs/*/; do
198
+ echo "=== Checking $dir ==="
199
+ for file in "$dir"*.md; do
200
+ if [ -f "$file" ]; then
201
+ # Extract just the relative path from docs/
202
+ relpath="${file#docs/}"
203
+ if ! grep -q "$relpath" mkdocs.yml; then
204
+ echo "ORPHANED: $relpath not found in mkdocs.yml nav"
205
+ fi
206
+ fi
207
+ done
208
+ done
209
+ ```
210
+
211
+ ## Anti-Patterns
212
+
213
+ ### ❌ Adding Files Without Nav Update
214
+
215
+ ```bash
216
+ # Create new documentation
217
+ echo "# New Feature" > docs/guides/new-feature.md
218
+ git add docs/guides/new-feature.md
219
+ git commit -m "Add new feature docs" # WRONG: mkdocs.yml not updated
220
+ ```
221
+
222
+ **Why it's wrong**: The page exists but users cannot navigate to it.
223
+
224
+ ### ❌ Incorrect Index Page Format
225
+
226
+ ```yaml
227
+ # WRONG: Index has a title, section header not clickable
228
+ nav:
229
+ - Concepts:
230
+ - Concepts Overview: concepts/index.md
231
+ - Message Types: concepts/message-types.md
232
+ ```
233
+
234
+ **Why it's wrong**: Users must click "Concepts Overview" to see the overview instead of clicking "Concepts" directly.
235
+
236
+ ### ❌ Random Page Order
237
+
238
+ ```yaml
239
+ # WRONG: Advanced topic before basics
240
+ nav:
241
+ - Concepts:
242
+ - concepts/index.md
243
+ - Interceptors: concepts/interceptors.md # Advanced!
244
+ - Mental Model: concepts/mental-model.md # Basic - should be first
245
+ ```
246
+
247
+ **Why it's wrong**: Users encounter advanced topics before understanding fundamentals.
248
+
249
+ ## Integration with Documentation Workflow
250
+
251
+ Add nav verification to the documentation update checklist:
252
+
253
+ 1. **Identify scope**: What documentation needs to change?
254
+ 1. **Create/modify files**: Add or update `.md` files in `docs/`
255
+ 1. **Update navigation**: Ensure all files appear in `mkdocs.yml` nav
256
+ 1. **Verify order**: Check logical progression within sections
257
+ 1. **Verify completeness**: Audit subdirectory against nav entries
258
+ 1. **Test locally**: Run `mkdocs serve` and verify navigation
259
+
260
+ ## Local Testing
261
+
262
+ Always test navigation changes locally before committing:
263
+
264
+ ```bash
265
+ # Install dependencies if needed
266
+ pip install -r requirements-docs.txt
267
+
268
+ # Serve documentation locally
269
+ mkdocs serve
270
+
271
+ # Open browser to http://localhost:8000
272
+ # Verify new pages appear in sidebar navigation
273
+ ```
274
+
275
+ ## See Also
276
+
277
+ - [Documentation Updates](documentation-updates.md)
278
+ - [Documentation Update Workflow](documentation-update-workflow.md)
279
+ - [Markdown Compatibility](markdown-compatibility.md)
280
+
281
+ ## References
282
+
283
+ - [MkDocs Navigation Configuration](https://www.mkdocs.org/user-guide/configuration/#nav)
284
+ - [Material for MkDocs Navigation](https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/)
285
+
286
+ ## Changelog
287
+
288
+ | Version | Date | Changes |
289
+ | ------- | ---------- | -------------------------------------------- |
290
+ | 1.0.0 | 2026-01-29 | Initial version - prevent orphaned doc pages |