Skip to content

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

@ransoing

Description

@ransoing
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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions