Closed kleinfreund closed 3 years ago
Just looking at the updated website, I think it is a really good idea, especially the big-list-of-options profits a lot from this. Alternatively, we could also put the list into the side-bar, but I was always wondering if this wouldn't make the side bar unusable. One might wonder if we want to work a little on the styling e.g. by refining the CSS for nested lists, but on first glance this looks ok-ish to me.
There is a tiny glitch after "JavaScript API" that I want to check out. Is unrelated and can be fixed in the markdown.
Alternatively, we could also put the list into the side-bar, but I was always wondering if this wouldn't make the side bar unusable.
I also think this would get very unwieldy. Personally, I much prefer the “per main section” table of contents. I also noticed that the FAQ document delibaretely starts its heading hierarchy at level 4 instead of level 3 like the other documents. Supposedly, this was done to avoid its level 3 headings to appear in the sidebar. But perhaps this isn’t intentional. Perhaps this should be changed?
One might wonder if we want to work a little on the styling e.g. by refining the CSS for nested lists, but on first glance this looks ok-ish to me.
Definitely. I didn’t add any styling on purpose because I wasn’t sure if the initial contribution would even be appreciated, so I deemed it the safer approach to skip any styling considerations. Perhaps the gap left of the table of contents could be made smaller, but overall I actually think the default style fits into the overall appearance of the site quite well.
I updated the PR based on the suggestion made in https://github.com/rollup/rollupjs.org/pull/228#discussion_r675949488. Let me know if you want me to squash the current commits into one.
In the last few commits (https://github.com/rollup/rollupjs.org/pull/228/commits/193e904ce23c83ef44e7ba4eae089ee7dc9354b1, https://github.com/rollup/rollupjs.org/pull/228/commits/f2b3b163f4d073a3f8f543eb4730a7456d4eb59f, and https://github.com/rollup/rollupjs.org/pull/228/commits/2aaca3eb5eda2a7153238b853c5be64dae0e31f9), the following changes were introduced:
<html lang="sk">
for https://rollupjs.org/guide/sk/)/guide/en
even when looking at https://rollupjs.org/guide/sk/Great work!
Small disclaimer: Please read this pull request as a proposition. I don’t know if you even want to have this on your website. If not in this form, I hope another way can be found to improve the site’s navigability. Also, I have never worked with Svelte before so please let me know if any changes to the PR in its current form are required.
Changes
Adds a generated, two-level deep table of contents to all subsections (i.e. to the documents found in the
guide/[lang]/
directories). The elements in the table of contents are plain links pointing to fragment identifiers of their corresponding heading elements (i.e. the heading elements’ ID attributes). This is intended to improve the navigability of the documentation especially for sections like “Plugin Development” and “Big list of options” which both have many, many sub sections.Moves the chain of
String.prototype.replace
calls sanitizing heading markup into its own function because it’s now also needed for the logic preparing the new table of content data. Also adds two new calls replacing the HTML entities<
and>
which appear in some of the headings (e.g. https://rollupjs.org/guide/en/#-p-plugin---plugin-plugin).Motivation
Pretty regularly when working with Rollup, I get a bit frustrated when looking up the documentation for a certain feature or configuration option because the website is one big document that has no built-in search beyond what a browser offers. I tend to resort to searching the page using full-text search (e.g. via Ctrl+F) which becomes tedious quickly when trying to look up options one finds in example configurations, etc.
Being able to click on the “Big list of options” entry in the main table of contents in the sidebar and then having a list of all the options linked to their sections is something I wanted many, many times when working with Rollup before so I figured it’s time to (try to) make it happen.
Miscellaneous
npm run lint
andnpm test
on this branch.