Skip to content

@link in description broken if target can be resolved #525

@kryops

Description

@kryops

Hi there,

when parsing JSDoc @link annotations with a link text set, the parser removes the space between the link target and the link text if the link's target can be resolved:

const MyOtherComponent = () => {};

/**
 * My component. Similar to
 * - {@link MyOtherComponent other component}.
 * - {@link MyOtherComponent|other component}.
 * - {@link MyOtherComponent2 other component 2}.
 * - {@link MyOtherComponent2|other component 2}.
 */
export const Foo = () => <div>...</div>;

Output:

description: 'My component. Similar to\n' +
      '- {@link MyOtherComponentother component}.\n' +
      '- {@link MyOtherComponentother component}.\n' +
      '- {@link MyOtherComponent2 other component 2}.\n' +
      '- {@link MyOtherComponent2 other component 2}.',

Expected:

description: 'My component. Similar to\n' +
      '- {@link MyOtherComponent other component}.\n' +
      '- {@link MyOtherComponent other component}.\n' +
      '- {@link MyOtherComponent2 other component 2}.\n' +
      '- {@link MyOtherComponent2 other component 2}.',

Thanks for looking into it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions