Typedoc: TypeDoc doesn't render comments with Handlebars 4.6.0

Created on 9 Jan 2020  路  11Comments  路  Source: TypeStrong/typedoc

Expected Behavior


Comments should be rendered when generating documents using globally installed typedoc. (i.e. npm install typedoc --global)

Note that it works as expected when installed locally.

# doesn't work - documentation rendered without comments
typedoc --out docs

# works - documentation rendered with comments
node_modules/.bin/typedoc --out docs

Expected:

Screen Shot 2020-01-09 at 2 31 38 AM

Actual Behavior

Comments aren't included when run using typedoc global install.

Screen Shot 2020-01-09 at 2 31 03 AM

The comment section is missing from the html output:

<section class="tsd-panel tsd-comment">
  <div class="tsd-comment tsd-typography">
    <div class="lead">
      <p>Base class for animals</p>
    </div>
  </div>
</section>

Steps to reproduce the bug

Command:

npm install typedoc --global

git clone https://github.com/socsieng/typedoc-plugin-typescript-declaration.git
cd typedoc-plugin-typescript-declaration/example
typedoc --out docs
open docs/classes/_index_.example.animal.html

Environment

  • Typedoc version: 0.15.6
  • Node.js version: 8.16.0
  • npm version: 6.4.1
  • nvm version: 0.34.0
  • OS: macOS Catalina 10.15.1 (19B88)
bug external reproduced

Most helpful comment

Fixed in v0.15.7, thanks for the report @socsieng + @jeremyrea!

Leaving this open to track finding a better solution. I don't want to be stuck on an old version of handlebars forever.

All 11 comments

I'm experiencing a similar issue, although it's the local installation that's not rendering the comments in the HTML output.

When I add the --json flag, I can see that my tags and shortText are properly picked-up in the object's comment property.

+1

This is.... really weird. I can confirm the global/local issue, no idea what's causing it yet. Looking into it.

@jeremyrea could you provide a repo with a repro for the issue when run locally?

It seems like the global install has been broken for a long time... [email protected] also has this issue.

@Gerrit0 https://github.com/jeremyrea/typedoc-comment-repro

Let me know how it goes or if there's anything else I can do.

Looks like Handlebars is the cause of this break (global + local I'm guessing, I bet the local install that works has a lower version of handlebars pinned in package-lock.json) - https://github.com/wycats/handlebars.js/pull/1633...

I'm not exactly sure how we should go about fixing this... listing out all of the prototype methods that we expect a template (as suggested in the handlebars PR) to be able to access isn't feasible and is very likely to break in the future whenever a new method is added.

For now, I'll pin handlebars to a lower version and release a patch with that change.

Fixed in v0.15.7, thanks for the report @socsieng + @jeremyrea!

Leaving this open to track finding a better solution. I don't want to be stuck on an old version of handlebars forever.

Thanks @Gerrit0, can confirm that it works for me.

Handlebars 4.7.0 has been release with options to disable prototype restrictions:
https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access

Thanks @nknapp!

I'll release 0.15.8 with a handlebars version bump to 4.7.0 later today :)

v0.15.8 is released

Was this page helpful?
0 / 5 - 0 ratings