-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
216 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { DefaultTheme, JSX, PageEvent, Reflection } from 'typedoc'; | ||
import { ThemeContext } from './ThemeContext'; | ||
import { DefaultTheme, JSX, PageEvent, Reflection } from "typedoc"; | ||
import { ThemeContext } from "./ThemeContext"; | ||
|
||
export class MarloweTheme extends DefaultTheme { | ||
override getRenderContext(pageEvent: PageEvent<Reflection>): ThemeContext { | ||
return new ThemeContext(this, pageEvent, this.application.options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
import { | ||
DefaultTheme, | ||
DefaultThemeRenderContext, | ||
JSX, | ||
Options, | ||
PageEvent, | ||
Reflection, | ||
} from 'typedoc'; | ||
import * as templates from './templates'; | ||
DefaultTheme, | ||
DefaultThemeRenderContext, | ||
JSX, | ||
Options, | ||
PageEvent, | ||
Reflection, | ||
} from "typedoc"; | ||
import * as templates from "./templates"; | ||
|
||
function bind<F, L extends any[], R>(fn: (f: F, ...a: L) => R, first: F) { | ||
return (...r: L) => fn(first, ...r); | ||
} | ||
|
||
export class ThemeContext extends DefaultThemeRenderContext { | ||
constructor(theme: DefaultTheme, page: PageEvent<Reflection>, options: Options) { | ||
constructor( | ||
theme: DefaultTheme, | ||
page: PageEvent<Reflection>, | ||
options: Options | ||
) { | ||
super(theme, page, options); | ||
this.init(); | ||
} | ||
init(){ | ||
init() { | ||
for (const [key, tpl] of Object.entries(templates)) { | ||
this[key as keyof ThemeContext] = bind(tpl as any, this) as any; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.