(theme, page, options)
| 58 | |
| 59 | class GrokThemeRenderContext extends MarkdownThemeContext { |
| 60 | constructor(theme, page, options) { |
| 61 | super(theme, page, options); |
| 62 | const superPartials = this.partials; |
| 63 | |
| 64 | const superHasUsefulTypeDetails = this.helpers.hasUsefulTypeDetails; |
| 65 | this.helpers = { |
| 66 | ...this.helpers, |
| 67 | hasUsefulTypeDetails: (type) => { |
| 68 | // The asciiMath.delimiters property for some reason does not have a .visit property |
| 69 | if (!type.visit) return false; |
| 70 | return superHasUsefulTypeDetails(type); |
| 71 | }, |
| 72 | }; |
| 73 | |
| 74 | this.templates = { |
| 75 | ...this.templates, |
| 76 | /** |
| 77 | * Template that maps to individual reflection models. |
| 78 | */ |
| 79 | reflection: (page) => { |
| 80 | const md = []; |
| 81 | |
| 82 | md.push(this.hook('page.begin', this).join('\n')); |
| 83 | |
| 84 | if (!this.options.getValue('hidePageHeader')) { |
| 85 | md.push(this.partials.header()); |
| 86 | } |
| 87 | |
| 88 | if (!this.options.getValue('hideBreadcrumbs')) { |
| 89 | md.push(this.partials.breadcrumbs()); |
| 90 | } |
| 91 | |
| 92 | if (!this.options.getValue('hidePageTitle')) { |
| 93 | md.push(heading(1, this.partials.pageTitle())); |
| 94 | } |
| 95 | |
| 96 | md.push(this.hook('content.begin', this).join('\n')); |
| 97 | |
| 98 | // @custom |
| 99 | if (page.model.kind === ReflectionKind.Module) { |
| 100 | md.push( |
| 101 | this.partials.memberWithGroups(page.model, { headingLevel: 1 }) |
| 102 | ); |
| 103 | } else if ( |
| 104 | [ |
| 105 | // ReflectionKind.Module, // @custom |
| 106 | ReflectionKind.Namespace, |
| 107 | ReflectionKind.Enum, |
| 108 | ReflectionKind.Class, |
| 109 | ReflectionKind.Interface, |
| 110 | ].includes(page.model.kind) |
| 111 | ) { |
| 112 | md.push( |
| 113 | this.partials.memberWithGroups(page.model, { headingLevel: 2 }) |
| 114 | ); |
| 115 | } else { |
| 116 | md.push( |
| 117 | this.partials.memberContainer(page.model, { headingLevel: 1 }) |
nothing calls this directly
no test coverage detected