Skip to content

Commit 68e029c

Browse files
committed
feat: quick reference index page
fix #242 fix #575
1 parent d178804 commit 68e029c

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

docs/mrdocs.schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@
231231
],
232232
"title": "Generator used to create the documentation"
233233
},
234+
"global-namespace-index": {
235+
"default": true,
236+
"description": "When set to true, the page for the global namespace will recursively list all symbols in the documentation, not just those in the global namespace. This makes the global namespace page act as an index for the entire project.",
237+
"enum": [
238+
true,
239+
false
240+
],
241+
"title": "Use the global namespace page as an index for all symbols",
242+
"type": "boolean"
243+
},
234244
"ignore-failures": {
235245
"default": false,
236246
"description": "When set to true, MrDocs continues to generate the documentation even if there are AST visitation failures. AST visitation failures occur when the source code contains constructs that are not supported by MrDocs.",

share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,13 @@
219219
{{#each symbol.doc.sees}}
220220
{{>javadoc/see .}}
221221
{{/each}}
222+
{{/if}}
223+
{{! Recursive index for multipage global namespace }}
224+
{{#if (and (eq symbol.kind "namespace") @root.config.multipage @root.config.global-namespace-index (eq @root.symbol.kind "namespace") (not @root.symbol.name) (not @root.symbol.parent)) }}
225+
{{#each symbol.members.namespaces}}
226+
{{#if isRegular}}
227+
{{#> markup/dynamic-level-h id=null }}{{> symbol/qualified-name . }} namespace{{/markup/dynamic-level-h}}
228+
{{> symbol symbol=. id=null traversing-global-namespace=true }}
229+
{{/if}}
230+
{{/each}}
222231
{{/if}}

share/mrdocs/addons/generator/common/partials/symbol/members-table.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
--}}
1717
{{#if members}}
1818
{{#if (or (eq members[0].class "name") (any_of_by members "isRegular" "isSeeBelow"))}}
19-
{{#>markup/h level=(select @root.config.multipage 1 2)}}{{title}}{{/markup/h}}
19+
{{#>markup/h level=(select @root.config.multipage (select traversing-global-namespace 2 1) 2)}}{{title}}{{/markup/h}}
2020
{{>symbol/detail/members-table-impl members=members isName=(eq members[0].class "name") includeBrief=(select (any_of_by members "doc") true false) title=title}}
2121

2222
{{/if}}

share/mrdocs/addons/generator/html/partials/symbol.html.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@
313313
{{/each}}
314314
</div>
315315
{{/if}}
316+
{{! Recursive index for multipage global namespace }}
317+
{{#if (and (eq symbol.kind "namespace") @root.config.multipage @root.config.global-namespace-index (eq @root.symbol.kind "namespace") (not @root.symbol.name) (not @root.symbol.parent)) }}
318+
{{#each symbol.members.namespaces}}
319+
{{#if isRegular}}
320+
{{#> markup/dynamic-level-h id=null }}{{> symbol/qualified-name . }} namespace{{/markup/dynamic-level-h}}
321+
{{> symbol symbol=. id=null traversing-global-namespace=true }}
322+
{{/if}}
323+
{{/each}}
324+
{{/if}}
316325
{{#unless @root.config.multipage }}
317326
</div>
318327
{{/unless}}

src/lib/ConfigOptions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@
409409
"details": "When set to true, MrDocs creates a page for each namespace in the documentation.",
410410
"type": "bool",
411411
"default": true
412+
},
413+
{
414+
"name": "global-namespace-index",
415+
"brief": "Use the global namespace page as an index for all symbols",
416+
"details": "When set to true, the page for the global namespace will recursively list all symbols in the documentation, not just those in the global namespace. This makes the global namespace page act as an index for the entire project.",
417+
"type": "bool",
418+
"default": true
412419
}
413420
]
414421
},

0 commit comments

Comments
 (0)