dart-lang / pub-dev

The pub.dev website
https://pub.dev
BSD 3-Clause "New" or "Revised" License
774 stars 145 forks source link

Square brackets work in the documentation page but not the package page #6281

Open atn832 opened 1 year ago

atn832 commented 1 year ago

Square brackets in README.md correctly generate a link to the relevant docs on the pub.dev/documentation page, but not on the pub.dev/packages page.

See

vs

AlexV525 commented 1 year ago

This is somehow related to Markdown specs, square brackets with an extra [] end can be recognized in most places (e.g. with the package page), but without an extra [] is not a standardized behavior. So as a workaround, you can manually add [] after these links in your markdown files. image image

atn832 commented 1 year ago

Hi @AlexV525, I had no idea about those features. Are they documented anywhere?

It looks like for this project, even GitHub renders those pub links and other links correctly. I tried using it on my repo but it doesn't seem to get parsed either on pub.dev nor GitHub. Any idea what I did wrong?

image

vs

image
atn832 commented 1 year ago

Ok nevermind, I see the mapping at the end of the file!

https://github.com/fluttercandies/flutter_wechat_assets_picker/blob/93cc6049f2ff7b72823674e550a3f8c9fc6a6a5d/README.md?plain=1#L555-L565

That still means I have to explicitly set the links. Otherwise https://pub.dev/packages/svg_drawing_animation can't parse it even though https://pub.dev/documentation/svg_drawing_animation/latest/ can.

Even though [name] alone is not standard Markdown behavior, it would be nice if pub.dev/packages pages behaved the same as pub.dev/documentation.

AlexV525 commented 1 year ago

Thanks for details. Now I can identify that it's because document pages are embedded with API references during compiling, but a README file doesn't. You'll need specify reference on your own in the README.

atn832 commented 1 year ago

Got it, thank you! I'll leave this open so that the pub-dev team can decide what to do with it.