Drarig29 / typedoc-plugin-extras

A plugin for TypeDoc which adds extras to the generated documentation
https://drarig29.github.io/typedoc-plugin-extras/
MIT License
13 stars 3 forks source link

Generation fails when using the built-in `minimal` theme #1

Closed danielwiehl closed 4 years ago

danielwiehl commented 4 years ago

The plugin fails to append the generation timestamp to the footer when using the built-in 'minimal' theme. When using the default theme, the plugin works as expected.

Error: Cannot read property 'innerHTML' of null

How to reproduce:

npx typedoc --plugin typedoc-plugin-extras --theme minimal

Analysis:

The error occurs because the plugin uses the direct descendant selector to locate the generator container div.

if (!this.application.options.getValue('hideGenerator') && (!hideDate || !hideTime)) {
  p = document.querySelector('body > div.container.tsd-generator > p');
  ...

However, when using the minimal theme, Typedoc adds some additional container elements between the body and the generator div.

DOM structure when using the default theme: body > div.container.tsd-generator > p

DOM structure when using the minimal theme: body > div.container.container-main > div.content-wrap > div.container.tsd-generator > p

Removing the child combinator between body and div.container.tsd-generator solves the problem.

Workaround:

As a workaround, if someone else also encounters this problem, simply disable the generation of the generator info by setting the flag --hideGenerator.

Version:

typedoc: v0.17.7 typedoc-plugin-extras: v1.1.3

Drarig29 commented 4 years ago

Thank you very much for the analysis, it saved me some time 😊 I just patched it, it's published in version 1.1.4

danielwiehl commented 4 years ago

Thank you very much for fixing the issue so quickly.