Skip to content

Commit de8da0d

Browse files
[Docs] Update docfx and remove tocFilter hack. (#3010)
* Update docfx and remove tocFilter hack. docfx PR 9912 fixed the TOC filter value not being kept between page loads. This removes the hack I used to get around it, but keeps the scroll code. * Update docs workflow.
1 parent 433bdc2 commit de8da0d

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
dotnet-version: 8.0.x
2828

2929
- name: Setup DocFX
30-
run: dotnet tool install -g docfx --version 2.76.0
30+
run: dotnet tool install -g docfx --version 2.77.0
3131

3232
- name: Build DNet docs
3333
run: docfx docs/docfx.json

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The documentation for the Discord.Net library uses [DocFX][docfx-main].
44
Instructions for installing this tool can be found [here][docfx-installing].
55

66
> [!IMPORTANT]
7-
> You must use DocFX version **2.76.0** for everything to work correctly.
7+
> You must use DocFX version **2.77.0** for everything to work correctly.
88
99
1. Navigate to the root of the repository.
1010
2. Build the docs using `docfx docs/docfx.json`. Add the `--serve`

docs/_template/material/public/main.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,18 @@
2222
{
2323
// Ugly hack to improve toc filter.
2424
let target = document.getElementById("toc");
25-
26-
if(!target) return;
27-
25+
26+
if (!target) return;
27+
2828
let config = { attributes: false, childList: true, subtree: true };
2929
let observer = new MutationObserver((list) =>
3030
{
31-
for(const mutation of list)
31+
for (const mutation of list)
3232
{
33-
if(mutation.type === "childList" && mutation.target == target)
33+
if (mutation.type === "childList" && mutation.target == target)
3434
{
35-
let filter = target.getElementsByClassName("form-control")[0];
36-
37-
let filterValue = localStorage.getItem("tocFilter");
3835
let scrollValue = localStorage.getItem("tocScroll");
3936

40-
if(filterValue && filterValue !== "")
41-
{
42-
filter.value = filterValue;
43-
44-
let inputEvent = new Event("input");
45-
filter.dispatchEvent(inputEvent);
46-
}
47-
4837
// Add event to store scroll pos.
4938
let tocDiv = target.getElementsByClassName("flex-fill")[0];
5039

@@ -56,7 +45,7 @@
5645
}
5746
});
5847

59-
if(scrollValue && scrollValue >= 0)
48+
if (scrollValue && scrollValue >= 0)
6049
{
6150
tocDiv.scroll(0, scrollValue);
6251
}

0 commit comments

Comments
 (0)