Commit ca1456b2 authored by Marco Cavalli's avatar Marco Cavalli
Browse files

feat: enhance link handling in HTML TOC generation to exclude certain fragment identifiers

parent 1bfe6557
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -667,9 +667,13 @@ if SRC_TYPE == "md" and DEST_TYPE == "html":
                if toc_soup:
                    for link in toc_soup.find_all("a", href=True):
                        href = link.get("href", "")
                        if link.string and (
                        if (
                            href == filename or href.startswith(f"{filename}#")
                        ):
                            if href.startswith(f"{filename}#"):
                                splitted_href = href.split("#", 1)
                                if "." in splitted_href[1]:
                                    continue
                            link["class"] = link.get("class", []) + [
                                "diff-changes-enable"
                            ]