Skip to content

Commit

Permalink
Merge pull request #1917 from matteobruni/master
Browse files Browse the repository at this point in the history
Added more render hooks
  • Loading branch information
Gerrit0 committed Apr 10, 2022
2 parents 815b943 + 7f9c618 commit bacefb6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

### Bug Fixes

Expand All @@ -13,6 +14,7 @@

- @ejuda
- @schlusslicht
- @matteobruni

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

Expand Down
20 changes: 20 additions & 0 deletions src/lib/output/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ export interface RendererHooks {
* Applied immediately before the closing `</body>` tag.
*/
"body.end": [DefaultThemeRenderContext];

/**
* Applied immediately before the main template.
*/
"content.begin": [DefaultThemeRenderContext];

/**
* Applied immediately after the main template.
*/
"content.end": [DefaultThemeRenderContext];

/**
* Applied immediately before calling `context.navigation`.
*/
"navigation.begin": [DefaultThemeRenderContext];

/**
* Applied immediately after calling `context.navigation`.
*/
"navigation.end": [DefaultThemeRenderContext];
}

/**
Expand Down
12 changes: 10 additions & 2 deletions src/lib/output/themes/default/layouts/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ export const defaultLayout = (context: DefaultThemeRenderContext, props: PageEve

<div class="container container-main">
<div class="row">
<div class="col-8 col-content">{props.template(props)}</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">{context.navigation(props)}</div>
<div class="col-8 col-content">
{context.hook("content.begin")}
{props.template(props)}
{context.hook("content.end")}
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
{context.hook("navigation.begin")}
{context.navigation(props)}
{context.hook("navigation.end")}
</div>
</div>
</div>

Expand Down

0 comments on commit bacefb6

Please sign in to comment.