Skip to content

Fix JS errors in doxygen navtree#6326

Draft
jhendersonHDF wants to merge 3 commits into
HDFGroup:developfrom
jhendersonHDF:fix_doxygen_navtree
Draft

Fix JS errors in doxygen navtree#6326
jhendersonHDF wants to merge 3 commits into
HDFGroup:developfrom
jhendersonHDF:fix_doxygen_navtree

Conversation

@jhendersonHDF

Copy link
Copy Markdown
Collaborator

Fixes anchor links in some browsers and restores the navtree alongside the Table of Contents for several pages

@jhendersonHDF

Copy link
Copy Markdown
Collaborator Author

This needs more testing before being merged to make sure the behavior is correct, but it should fix anchor links in some browsers and allow the navtree to exist alongside the created TOC.

Sample page before:
Docs Before

After:
Docs After

Comment thread doxygen/hdf5_navtree_hacks.js Outdated
@@ -1,3 +1,524 @@
/*
@licstart The following is the entire license notice for the JavaScript code in this file.

@jhendersonHDF jhendersonHDF Mar 27, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the functions that were being overridden before are nested functions now, so we're effectively just modifying the original code. Included the license in this file.

However, the note below of "The above is the entire license notice for the JavaScript code in this file" is not necessarily the case for code that we added, so it may need to be put in a separate file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that we need to add an additional license due to us adding code, or that because we've modified parts of this code, the license should be moved? From reading the license information, it seems like the license holds even with modifications to the code.

@jhendersonHDF jhendersonHDF Mar 31, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bit ambiguous since previously we were just overriding the original code with our own functions without having directly modified the original code. It's possible that some of those modifications, such as the new functions we added, could have been covered under our BSD license, but the rest of the code was similar to the original code from what I could tell, so that may have been more appropriately covered under the missing MIT license.

Since then, the functions that we were overriding have been moved to being nested functions, meaning that overriding them won't work as intended and we now have to modify the original code. The same new functions we added could be covered under the MIT license or our BSD license.

Comment thread doxygen/hdf5_navtree_hacks.js Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vast majority of the changes in this file consist of just copying over navtree.js from a build directory and modifying just a few spots from the previous logic.

Comment thread doxygen/hdf5_navtree_hacks.js Outdated
domNode.appendChild(node.expandToggle);
// Each item in the nav tree is currently 30px. This may change, but
// this knowledge is needed to get a reasonable size for the TOC.
if (NAVTREE) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were many cases where the height of the TOC was larger than the calculated window height, which would cause weirdness with resizing. Doxygen appears to give us navtreedata.js, which contains this variable to tell us how many items are in the navtree. Given that those items are 30px in height currently, this gives a reasonable limit on the size of the navtree. This is somewhat fragile, but the most practical way I could think of to determine how to size the navtree against the TOC.

Comment thread doxygen/hdf5_navtree_hacks.js Outdated
// Hide the root node "HDF5"
$(document.getElementsByClassName('index.html')[0]).parent().parent().css({display:"none"});

resizeHeight();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to make sure things get resized at an appropriate time.

Comment thread doxygen/hdf5_navtree_hacks.js Outdated
a.href = srcPage!=targetPage ? url : aname;
a.onclick = function() {
storeLink(link);
aPPar = $(a).parent().parent();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates an accidental global. Should be const aPPar = ....

@brtnfld

brtnfld commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

The top tabs already provide the global navigation (Getting Started, User Guide, Reference Manual, Cookbook, etc.). So the sidebar navtree is duplicating that.

@jhendersonHDF

Copy link
Copy Markdown
Collaborator Author

The top tabs already provide the global navigation (Getting Started, User Guide, Reference Manual, Cookbook, etc.). So the sidebar navtree is duplicating that.

Im happy to simply have the TOC take up all the space and overwrite the navtree, but then the question becomes what point is there in having the navtree?

@jhendersonHDF

Copy link
Copy Markdown
Collaborator Author

Using the PAGE_OUTLINE_PANEL from Doxygen 14+ looks like below. Seems like this might be preferable to trying to hack our own together.

Screenshot_2026-04-07_14-25-22

@jhendersonHDF jhendersonHDF marked this pull request as draft April 28, 2026 21:07
@lrknox lrknox removed their request for review June 11, 2026 21:17
Fixes anchor links in some browsers and restores the navtree
alongside the Table of Contents for several pages
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

This draft has had no activity for 60 days and has been marked draft-stale.

  • Still working on this -- check this box to keep the draft open

Checking the box is the only thing that resets this -- a commit or other automated update alone won't. Otherwise it will be flagged for maintainer review.

@github-actions github-actions Bot added draft-stale Draft PR with no activity past the draft staleness window and removed draft-stale Draft PR with no activity past the draft staleness window labels Jun 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for confirming — removing the stale label.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

This PR touches the following areas. Each needs a sign-off
from its listed owners before merging.

Additional reviewers (not owners of a touched area): @fortnern, @bmribler, @mattjala

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Documentation Doxygen, markdown, etc.

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

HDF5 File Format Specification links are not copyable

6 participants