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] Update docfx and remove tocFilter hack. #3010

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
dotnet-version: 8.0.x

- name: Setup DocFX
run: dotnet tool install -g docfx --version 2.76.0
run: dotnet tool install -g docfx --version 2.77.0

- name: Build DNet docs
run: docfx docs/docfx.json
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The documentation for the Discord.Net library uses [DocFX][docfx-main].
Instructions for installing this tool can be found [here][docfx-installing].

> [!IMPORTANT]
> You must use DocFX version **2.76.0** for everything to work correctly.
> You must use DocFX version **2.77.0** for everything to work correctly.

1. Navigate to the root of the repository.
2. Build the docs using `docfx docs/docfx.json`. Add the `--serve`
Expand Down
23 changes: 6 additions & 17 deletions docs/_template/material/public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,18 @@
{
// Ugly hack to improve toc filter.
let target = document.getElementById("toc");
if(!target) return;

if (!target) return;

let config = { attributes: false, childList: true, subtree: true };
let observer = new MutationObserver((list) =>
{
for(const mutation of list)
for (const mutation of list)
{
if(mutation.type === "childList" && mutation.target == target)
if (mutation.type === "childList" && mutation.target == target)
{
let filter = target.getElementsByClassName("form-control")[0];

let filterValue = localStorage.getItem("tocFilter");
let scrollValue = localStorage.getItem("tocScroll");

if(filterValue && filterValue !== "")
{
filter.value = filterValue;

let inputEvent = new Event("input");
filter.dispatchEvent(inputEvent);
}

// Add event to store scroll pos.
let tocDiv = target.getElementsByClassName("flex-fill")[0];

Expand All @@ -56,7 +45,7 @@
}
});

if(scrollValue && scrollValue >= 0)
if (scrollValue && scrollValue >= 0)
{
tocDiv.scroll(0, scrollValue);
}
Expand Down