fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
462 stars 155 forks source link

[Feature Request] Table Of Contents for easier skimming #778

Closed Darkle closed 1 year ago

Darkle commented 1 year ago

When browsing the https://fsharp.github.io/fsharp-core-docs/ docs I find it takes a while to scroll through a page to find what I want. For example the Array api page is fairly large and can be laborious to scroll through to find what you want (especially if you are new to F# and dont know what to use yet)

I think it would be a good idea to have a Table Of Contents at the top of api pages which link to their respective api section anchor, so you can more easily skim through to see what you want/need without having to scroll through a long page.

I created a userscript here to do what i want FWIW: https://greasyfork.org/en/scripts/454708-fsharp-library-docs-easy-skim-toc

Here are some screenshots of what it could look like:

script-ss-1

Showing summaries:

script-ss-2

The "Show Summaries" button would be an optional "nice to have" i guess; this feature request is mostly about having a Table Of Contents.

baronfel commented 1 year ago

This would be good to have - multiple people have requested this. In an ideal world the ToC would be collapsible as well.

nhirschey commented 1 year ago

I think a fairly simple way to implement this would be to wrap the description in a <details> tag, using the function or member summary as the html <summary>. Here's a gif showing a quick and dirty result via me manually editing the array page using brower tools.

I prefer the "details" option because then you don't have to scroll back and forth between a large table of contents at the top of the page and the content at the bottom bottom of the page. <details> allows you to scroll through the documentation, expanding and collapsing the function description as needed.

details