Skip to content

Custom Themes: Default theme not being inherited #2490

@Ehesp

Description

@Ehesp

Hello

I'm trying to modify the default theme. I've got a directory alongside my application which contains the theme, so I'm importing the distributed files as a plugin, then applying the theme, e.g:

typedoc --plugin ./my-theme --theme custom

The code for my theme is pretty simple, and follows the docs here: https://github.com/TypeStrong/typedoc/blob/master/internal-docs/custom-themes.md

The code (modified, as I think those are slightly out of date):

class MyThemeContext extends DefaultThemeRenderContext {
   // ...
}

class MyTheme extends DefaultTheme {
    private _contextCache?: MyThemeContext;
    override getRenderContext(page) {
        this._contextCache ||= new MyThemeContext(
            this, // <-- changed
			page, // <-- added
            this.application.options,
        );
        return this._contextCache;
    }
}

export function load(app: Application) {
    app.renderer.defineTheme("custom", MyTheme);
}

I kind of expected the theme in this case to be exactly the same as the default one, where I could then override specific parts such as the footer.. However instead the generated docs contain none of the sub-pages (classes, interfaces etc) and no CSS styles.

Is this expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions