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

[docs] Support anchor links #109

Closed
wants to merge 1 commit into from

Conversation

brenns10
Copy link

I was excited to see the new Docs plugin, but when I downloaded the Python 3 docset, I saw that most of the documentation items were missing, which was unfortunate. I read the code and saw that the items which were missing from the index were items that had anchor links. The code comments say that they are skipped because the web browser won't open them.

I came up with what I think is a clever workaround: create a temporary HTML file which contains a meta directive that tells the browser to immediately redirect to the target page, with the anchor appended. Then, we can use openUrl() on that temporary file without needing to pass an anchor in.

But full disclosure: I have very little C++ under my belt, and no Qt experience. The implementation I made is likely pretty garbage. It would need some love:

  1. It doesn't use a proper temporary file, since that would need to be cleaned up later and I didn't know how to handle that.
  2. It doesn't properly handle filenames with quotes: they would need to be escaped in order to create valid HTML.

Either Qt or the web browsers seem a bit finicky about handling a
file:// URI which has a fragment ("anchor") at the end of it. We can
work around this by creating a temporary HTML file with an immediate
redirect.

Signed-off-by: Stephen Brennan <[email protected]>
@ManuelSchneid3r
Copy link
Member

This issue was not intentionally but automatically closed because I renamed the master branch to main. If you are still interested in getting it merged please reopen against main.

ManuelSchneid3r added a commit that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants