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

[MAINTENANCE] Add the fragment back to internal references #6845

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/sphinx_api_docs_source/build_sphinx_api_docs.py
Expand Up @@ -178,10 +178,23 @@ def _process_and_create_docusaurus_mdx_files(self) -> None:
internal_refs = doc.find_all(class_="reference internal")
for internal_ref in internal_refs:
href = internal_ref["href"]

split_href = href.split("#")

shortened_path_version = self._get_mdx_file_path(
pathlib.Path(href.split("#")[0])
pathlib.Path(split_href[0])
).with_suffix(".html")
absolute_href = self._get_base_url() + str(shortened_path_version)

fragment = ""
if len(split_href) > 1:
fragment = split_href[1]

absolute_href = (
self._get_base_url()
+ str(shortened_path_version)
+ "#"
+ fragment
)
internal_ref["href"] = absolute_href

doc_str = str(doc)
Expand Down