Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX theming #1631

Closed
cspotcode opened this issue Jul 15, 2021 · 5 comments
Closed

JSX theming #1631

cspotcode opened this issue Jul 15, 2021 · 5 comments
Labels
enhancement Improved functionality

Comments

@cspotcode
Copy link
Contributor

cspotcode commented Jul 15, 2021

Creating an issue to track the work that I'm doing.

Search Terms

jsx, theme, handlebars

Problem

Themes implemented in handlebars, do not use native TS language features. Themes can be typechecked, compiled, and rendered with less tooling if they are written natively in TS.

Suggested Solution

Implement themes as JSX components which can be rendered at build time to static HTML.

Theme is an object with functions/methods. Default themes are implemented as a class, so they can be subclassed, but themes can also use {...defaultTheme, ...overrideFunctions} if they prefer to avoid classes.

Some "extension points" in the theme can be implemented as stubbed methods which return void. Theme implementers can choose to implement these methods to inject markup into the emitted docs.

Related issues:
#1266
TypeStrong/typedoc-default-themes#137
#1543

@cspotcode cspotcode added the enhancement Improved functionality label Jul 15, 2021
@Gerrit0 Gerrit0 added this to In Progress in Version 0.22 Aug 1, 2021
@milesj
Copy link

milesj commented Aug 13, 2021

FWIW, I basically rewrote all the handlebar templates in React here: https://github.com/milesj/docusaurus-plugin-typedoc-api/tree/master/packages/plugin/src/components

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 13, 2021

I wish we'd known about that sooner! TypeDoc's themes on the beta branch basically duplicated that work

@milesj
Copy link

milesj commented Aug 13, 2021

@Gerrit0 Yeah saw that too 😅

They are a bit different though, as mine is based on the JSON, while the new ones seem based on the model? Which kind of makes them not easily reusable.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 13, 2021

To some extent - I plan on doing something like #1646, but that uses the existing JSON output to deserialize

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 10, 2021

v0.22.0 has been released with this included in it

@Gerrit0 Gerrit0 closed this as completed Sep 10, 2021
@Gerrit0 Gerrit0 moved this from In Progress to Done in Version 0.22 Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
No open projects
Development

No branches or pull requests

3 participants