readthedocs / addons

JavaScript client to integrate with Read the Docs nicely
https://readthedocs-addons.readthedocs.io/
MIT License
22 stars 6 forks source link

Link previews: updates after meeting #433

Closed humitos closed 1 week ago

humitos commented 2 weeks ago
  1. Apply link previews only on links from the same domain as current
  2. Auto detect the doctool used
  3. Create a specific selector based on doctool detected
  4. Allow overriding the CSS selector if it's sent in the API

Related https://github.com/readthedocs/readthedocs.org/pull/11767

humitos commented 1 week ago

I updated this PR by reusing all the auto-detect logic we were using for EthicalAds. With that logic, we are now using specific CSS selector based on the documentation tool detected -- if we don't detect any doctool, we iterate over generic CSS selectors and stop after finding the first one.

The user can override the CSS root selector to avoid using the auto-detection logic by specifying a value in from the Web UI.

humitos commented 1 week ago

Wohoo! I updated the PR with the feedback and I'll merge it now 🚀

Please, give it a try locally with different examples and let me know if you find any issue.