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

TypeDoc doesn't render comments with Handlebars 4.6.0 #1159

Closed
1 task done
socsieng opened this issue Jan 9, 2020 · 12 comments
Closed
1 task done

TypeDoc doesn't render comments with Handlebars 4.6.0 #1159

socsieng opened this issue Jan 9, 2020 · 12 comments
Labels
bug Functionality does not match expectation external Problem lies outside of TypeDoc

Comments

@socsieng
Copy link
Contributor

socsieng commented Jan 9, 2020

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)
@socsieng socsieng added the bug Functionality does not match expectation label Jan 9, 2020
@jeremyrea
Copy link

jeremyrea commented Jan 9, 2020

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.

@kobezzza
Copy link

kobezzza commented Jan 9, 2020

+1

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 9, 2020

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?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 9, 2020

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

@jeremyrea
Copy link

jeremyrea commented Jan 9, 2020

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

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

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 9, 2020

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) - handlebars-lang/handlebars.js#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.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 9, 2020

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.

@Gerrit0 Gerrit0 added the fixed label Jan 9, 2020
@Gerrit0 Gerrit0 changed the title typedoc global install doesn't render comments TypeDoc doesn't render comments with Handlebars 4.6.0 Jan 9, 2020
@socsieng
Copy link
Contributor Author

socsieng commented Jan 9, 2020

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

@Gerrit0 Gerrit0 added external Problem lies outside of TypeDoc and removed Priority: 1 labels Jan 9, 2020
@nknapp
Copy link

nknapp commented Jan 10, 2020

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

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 10, 2020

Thanks @nknapp!

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

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jan 10, 2020

v0.15.8 is released

@Gerrit0 Gerrit0 closed this as completed Jan 10, 2020
tchetwin added a commit to tchetwin/pasta-sourcemaps that referenced this issue Apr 30, 2020
As per TypeStrong/typedoc#1159, in response to
security concerns, handlebars 4.6.0 changed in a way that broke our
version of typedoc. This was fixed and made available in 0.15.7.

This is fortunate as typedoc 0.16.0 makes a breaking change that exposes
a lot more than I think we want to:
https://github.com/TypeStrong/typedoc/releases/tag/v0.16.0

The current lead maintainer outlines a new vision for a "library" mode
here which may be of interest in future:
TypeStrong/typedoc#1266

Signed-off-by: Thomas Chetwin <[email protected]>
@PFight
Copy link

PFight commented Jan 9, 2023

For those, who use old versions of typedoc, there workaround. Add -D [email protected] to npm install, or use "overrides" in package.json. For example:

npm i [email protected] -g -D [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation external Problem lies outside of TypeDoc
Projects
None yet
Development

No branches or pull requests

6 participants