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 directive is broken: no syntax highlighting #884

Closed
paulmillr opened this issue Jan 8, 2025 · 3 comments
Closed

jsdoc @example directive is broken: no syntax highlighting #884

paulmillr opened this issue Jan 8, 2025 · 3 comments

Comments

@paulmillr
Copy link

Consider this JS/ts code:

/**
 * Creates new QRCamera from frontal camera
 * @example
 * const canvas = new QRCanvas();
 * const camera = frontalCamera();
 */
export async function frontalCamera(player: HTMLVideoElement): Promise<QRCamera>

Example directive is perfectly valid JS code, and has always been. However, JSR doesn't highlight it -- and even worse, doesn't even add line-breaks. JSR needs this:

@example
```js
const canvas = new QRCanvas();
const camera = frontalCamera();
```

It's unreasonable to require all jsdoc code example to be replaced by this flavored markdown just because you can't fix your code.

@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Jan 8, 2025
@crowlKats
Copy link
Collaborator

In our docs, we state that we support jsdoc-style comments and related standards. On the case of examples, we align more with TSDoc than JSDoc, since its much simpler and clearer than an ambiguous than having just free-lying code, especially since many of the examples also have some text in it.
We won't be changing this behaviour because besides being complex (and potentially expensive from a computation perspective since all jsdoc examples would need to tried to be parsed to see if they are valid code), it would potentially break existing examples.

@github-project-automation github-project-automation bot moved this from Needs Triage to Done in JSR Jan 16, 2025
@paulmillr
Copy link
Author

it would potentially break existing examples

You already break ALL existing code which is not on JSR.

@paulmillr
Copy link
Author

Also, tsdoc is not mentioned anywhere in your docs.

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

No branches or pull requests

2 participants