Skip to content

Commit 914439a

Browse files
committed
feat: added more render hooks
1 parent 815b943 commit 914439a

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Classes which are `abstract` and enums which are `const` will now be indicated in their rendered documentation, #1874.
66
- Added a new option `compilerOptions`, which can be used to override compiler options read from `tsconfig.json`, #1891.
7+
- Added new render hooks: `content.begin`, `content.end`, `navigation.begin`, `navigation.end`
78

89
### Bug Fixes
910

@@ -13,6 +14,7 @@
1314

1415
- @ejuda
1516
- @schlusslicht
17+
- @matteobruni
1618

1719
## v0.22.14 (2022-04-07)
1820

src/lib/output/renderer.ts

+20
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,26 @@ export interface RendererHooks {
4949
* Applied immediately before the closing `</body>` tag.
5050
*/
5151
"body.end": [DefaultThemeRenderContext];
52+
53+
/**
54+
* Applied immediately before the main template.
55+
*/
56+
"content.begin": [DefaultThemeRenderContext];
57+
58+
/**
59+
* Applied immediately after the main template.
60+
*/
61+
"content.end": [DefaultThemeRenderContext];
62+
63+
/**
64+
* Applied immediately before calling `context.navigation`.
65+
*/
66+
"navigation.begin": [DefaultThemeRenderContext];
67+
68+
/**
69+
* Applied immediately after calling `context.navigation`.
70+
*/
71+
"navigation.end": [DefaultThemeRenderContext];
5272
}
5373

5474
/**

src/lib/output/themes/default/layouts/default.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ export const defaultLayout = (context: DefaultThemeRenderContext, props: PageEve
3434

3535
<div class="container container-main">
3636
<div class="row">
37-
<div class="col-8 col-content">{props.template(props)}</div>
38-
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">{context.navigation(props)}</div>
37+
<div class="col-8 col-content">
38+
{context.hook("content.begin")}
39+
{props.template(props)}
40+
{context.hook("content.end")}
41+
</div>
42+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
43+
{context.hook("navigation.begin")}
44+
{context.navigation(props)}
45+
{context.hook("navigation.end")}
46+
</div>
3947
</div>
4048
</div>
4149

0 commit comments

Comments
 (0)