typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
725 stars 177 forks source link

postRenderAsyncJobs doesn't work in watch mode #630

Closed xixixao closed 5 months ago

xixixao commented 5 months ago

What package is the bug related to?

typedoc-plugin-markdown

Describe the issue

When running npx typedoc --watch the postRenderAsyncJobs only executes once. It should run after each render.

TypeDoc configuration

No response

Expected behavior

No response

tgreyuk commented 5 months ago

As is the case for html theme, postRenderAsyncJobs are intentionally cleared after the first render so won't trigger after each change in watch node.

As a workaround I suppose you can re-assign the jobs after each render:

const postAsyncJobs = () => {
  app.renderer.postRenderAsyncJobs.push(async (output) => {
    // do something after render
   });
};

// initial
postAsyncJobs();

// set after each subsequent render
app.renderer.on(MarkdownRendererEvent.END, () => {
  postAsyncJobs();
});
xixixao commented 5 months ago

Thanks, would be nice to document this in docs!