I would like to create a custom theme that generates a single README.md file containing the entire public API for a project – suitable for small or mid-sized project on GitHub, for example. To do that, I would need to modify not just the Handlebars templates, but the theme.js file. This is apparently possible according to the documentation, but the part of the code that allows this to happen is commented out. Is there a reason for this? Or am I missing something?
If I'm not totally confused about this, I think there are three ways in which creating a custom theme.js file could be made easier:
theme.js, it should be imported with a require() call. The creator of the theme could then import the relevant classes (e.g. DefaultTheme, Renderer) from a single module. This would also make it possible to extend any theme – not just the default theme – which would resolve issue #36.theme.ts file.theme.js or theme.ts file.To illustrate, a theme.ts file might look like this:
// A single module exports the entire public API
import {DefaultTheme, AssetsPlugin, PageEvent} from 'typedoc/api';
// export = ... should also work for compatibility with module.exports in plain JS
export default class ReadmeTheme extends DefaultTheme {
constructor(renderer, basePath) {
super(renderer, basePath);
// Remove components with the constructor to guard against typos and naming conflicts
renderer.removeComponent(AssetsPlugin);
this.listenTo(renderer, PageEvent.BEGIN, this.onRendererBeginPage);
}
// ...
}
These changes would likely be time-consuming, but I think they would make TypeDoc much more powerful. I would be happy to help with this in whatever way I can. I could even do a pull request, but I would certainly like some input first.
Thank you for this fantastic project.
Here's a little workaround:
https://github.com/thepalebluedot/typedoc-md-theme
:+1: I'd like to see typedoc have an out-of-box markdown output support.
typedoc-md-theme no longer exists it seems
Most helpful comment
:+1: I'd like to see typedoc have an out-of-box markdown output support.