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

[BUG] @example for methods renders twice for methods and in the wrong spot for properties #1385

Closed
ransoing opened this issue Sep 18, 2023 · 1 comment
Assignees

Comments

@ransoing
Copy link

Overview of the issue

When I use the @example jsdoc tag in the comment for a class method, the example is rendered twice.

This bug is present in the official Compodoc live example:
https://compodoc.github.io/compodoc-demo-todomvc-angular/injectables/TodoStore.html#setAllTo

Furthermore, even though the block-property.hbs template has an "Example" section, this is not rendered.

Here's the local example I used to duplicate the issues.

Code:
image

Rendered docs:
First, the function, which does it correctly by omitting the @example content from the description and only includes it under the "Example:" header:
image

And now the rendered docs for the class property and method. As per the .hbs file for class properties, there should be an "Example" header but there is not, and the example for the class method is clearly seen twice.
image

Compodoc version

Latest( @compodoc/compodoc 1.1.21 )

Angular configuration, a package.json file in the root folder

Default fresh setup for the latest Angular and Compodoc

{
  "name": "my-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "compodoc:build": "compodoc -p tsconfig.doc.json",
    "compodoc:build-and-serve": "compodoc -p tsconfig.doc.json -s",
    "compodoc:serve": "compodoc -s"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.2.0",
    "@angular/common": "^16.2.0",
    "@angular/compiler": "^16.2.0",
    "@angular/core": "^16.2.0",
    "@angular/forms": "^16.2.0",
    "@angular/platform-browser": "^16.2.0",
    "@angular/platform-browser-dynamic": "^16.2.0",
    "@angular/router": "^16.2.0",
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@compodoc/compodoc": "^1.1.21",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.2.2",
    "@angular/cli": "~16.2.2",
    "@angular/compiler-cli": "^16.2.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.1.3"
  }
}
Compodoc installed globally or locally ?

locally

@vogloblinsky
Copy link
Contributor

The duplicate in the example project is a typo. I will push the fix.
For the main bug, yes there is duplicate feature of displaying example code.
For simple code and internal process, i think removing the Example part and move it inside the method or property description part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants