dart-lang / dartdoc

API documentation tool for Dart.
https://pub.dev/packages/dartdoc
BSD 3-Clause "New" or "Revised" License
473 stars 118 forks source link

add option to hide deprecated APIs in web view #3921

Open Luckey-Elijah opened 4 weeks ago

Luckey-Elijah commented 4 weeks ago

Example: When browsing pub.dev/documentation/somepackage I would like the ability to "hide" all deprecated APIs as developers would not be needing to read the APIs.

srawlins commented 4 weeks ago

Thanks for the suggestion! I would say that, until the API is no longer available, a developer may want to see the deprecated API, so that they can read how to stop using it; what the replacement is; what the old signature is vs what the replacement is; why it is being removed, etc.

Luckey-Elijah commented 4 weeks ago

Yes I agree. I think that the ability to view them should be priority. Just for those that know they don't need to see them, it would be nice to hide those unused APIs.

A more specific use case: flutter_riverpod is preparing for a "big version 3 release" so many APIs are marked as deprecated. From a simple document.querySelectorAll('.deprecated').length; query I can see that 69 elements (at the time of this comment) are marked as deprecated. Those entries are valuable to those who need them but can be an "eye sore" or generally unhelpful for those that are not using API deprecated APIs; hence, the idea to toggle hide/showing them.

I currently can use

document.querySelectorAll('.deprecated').forEach(function(el) {
   el.style.display = 'none'; // use null to revert
});

in the browser console to get an idea of how I would want it to look.

Hopefully, this is more helpful for what I had in mind.

srawlins commented 4 weeks ago

Ah I see. Yes this would be a cool feature. A little toggle.