Skip to content

Commit

Permalink
Move generator into <footer>
Browse files Browse the repository at this point in the history
Resolves #2532
  • Loading branch information
Gerrit0 committed Apr 7, 2024
1 parent 7ed0e46 commit b533004
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Added `gitRevision:short` placeholder option to `--sourceLinkTemplate` option, #2529.
Links generated by TypeDoc will now default to using the non-short git revision.
- Moved "Generated by TypeDoc" footer into a `<footer>` tag, added `footer.begin` and `footer.end`
render hooks for use by custom plugins, #2532.

### Bug Fixes

Expand Down
10 changes: 10 additions & 0 deletions src/lib/output/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ export interface RendererHooks {
* Applied immediately after calling `context.pageSidebar`.
*/
"pageSidebar.end": [DefaultThemeRenderContext];

/**
* Applied immediately before the "Generated by TypeDoc" link in the footer.
*/
"footer.begin": [DefaultThemeRenderContext];

/**
* Applied immediately after the "Generated by TypeDoc" link in the footer.
*/
"footer.end": [DefaultThemeRenderContext];
}

/**
Expand Down
15 changes: 9 additions & 6 deletions src/lib/output/themes/default/partials/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";

export function footer(context: DefaultThemeRenderContext) {
const hideGenerator = context.options.getValue("hideGenerator");
if (!hideGenerator)
return (
<div class="tsd-generator">
<p>
return (
<footer>
{context.hook("footer.begin")}
{hideGenerator || (
<p class="tsd-generator">
{"Generated using "}
<a href="https://typedoc.org/" target="_blank">
TypeDoc
</a>
</p>
</div>
);
)}
{context.hook("footer.end")}
</footer>
);
}
9 changes: 3 additions & 6 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,14 @@ dd {
}

/* Footer */
.tsd-generator {
footer {
border-top: 1px solid var(--color-accent);
padding-top: 1rem;
padding-bottom: 1rem;
max-height: 3.5rem;
}

.tsd-generator > p {
margin-top: 0;
margin-bottom: 0;
padding: 0 1rem;
.tsd-generator {
margin: 0 1em;
}

.container-main {
Expand Down

0 comments on commit b533004

Please sign in to comment.