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

jsdoc @example & @examples are both output into "examples" field #1619

Open
JoshuaCarter opened this issue Mar 28, 2023 · 1 comment · May be fixed by #1705
Open

jsdoc @example & @examples are both output into "examples" field #1619

JoshuaCarter opened this issue Mar 28, 2023 · 1 comment · May be fixed by #1705

Comments

@JoshuaCarter
Copy link

JoshuaCarter commented Mar 28, 2023

In short, I want pic below:

Screenshot from 2023-03-28 16-42-16

But can only have pic below:

Screenshot from 2023-03-28 16-43-04

for (const example of jsDocTags.filter((tag) => tag.name === "example")) {
const text = (example.text ?? []).map((part) => part.text).join("");
try {
examples.push(json5.parse(text));

Code above reads in the @example jsdoc field and outputs it as examples: .... The @examples field seems to be automatically/generically output as the examples: ... field.

From what I can see, the getExampleAnnotation method should not read in the @example jsdoc field, and should read in the @examples jsdoc field. Or perhaps both should be explicitly handled?

@JoshuaCarter JoshuaCarter changed the title jsdoc @example & @examples are both output into "examples" fields. jsdoc @example & @examples are both output into "examples" field Mar 28, 2023
@cedvdb
Copy link

cedvdb commented Jun 21, 2023

@JoshuaCarter are you going to submit a PR ?

It seems to me it should return { example: examples[0] } at the end if there is only one example.

@cedvdb cedvdb linked a pull request Jun 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants