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

tsdoc links crossing multiple lines are mangled #1497

Open
TimothyJones opened this issue Nov 20, 2024 · 0 comments
Open

tsdoc links crossing multiple lines are mangled #1497

TimothyJones opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working p2

Comments

@TimothyJones
Copy link

Version: [email protected] (via [email protected])

Originally opened here

Summary

When using jsii-docgen in json mode, multi-line @link elements are mangled.

Description

I have some documentation like the following (note the multi-line tsdoc @link in the first line):

/**
 * Matches the content of a variable that comes from a state. See {@link https://case.contract-testing.io/docs/defining-contracts/state-definitions | state
 * definitions}
 * and {@link https://case.contract-testing.io/docs/reference/state-handlers | state handlers} for
 * more details.
 *
 * @public
 */
export class StateVariable extends AnyMatcher {
   /* ... */
}

The generated remarks section in the json doc is mangled - it assumed the first link finishes at the end of the first line, so the text link ends state} * definitions }.

Expected behaviour

The parsed link appears as:

See {@link https://case.contract-testing.io/docs/defining-contracts/state-definitions state definitions}

Actual behaviour

The link appears as

See {@link https://case.contract-testing.io/docs/defining-contracts/state-definitions state} * definitions}

Note that:

  • The link ends twice, once after state, and again after definitions
  • The * from the next line is erroneously included

Reproduction

I've created this repository illustrating this and another problem (about to be reported).

The relevant part for this issue is the parsing of this line:

/**
 * This class reproduces the bugs at {@link https://github.com/cdklabs/jsii-docgen/issues/1633 | this 
 * issue} 

Which results in this line in the assembly, which contains:

  {@link https://github.com/cdklabs/jsii-docgen/issues/1633 this } * issue} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

No branches or pull requests

2 participants