docsifyjs / docsify

πŸƒ A magical documentation site generator.
https://docsify.js.org
MIT License
27.47k stars 5.67k forks source link

Collapsible content and lazy loading / rendering. #2206

Closed novaknole closed 7 months ago

novaknole commented 1 year ago

Feature request

Problem or desire

I have been writing some docs for my own use case. The library is amazing. Though I need ideas.

Some pages are quite long, so I got tired of scrolling to get to the bottom of the page. You might say that I can create other pages and separate them, but I don't want it. I need to have it on the same page.

I got 2 things I want to find a way about:

I would love to have the following: some collapsibles such as you go to the page, and you see 15 collapsibles and clicking on each of them shows the contet later. I couldn't find anything through docsify, so I did it with my own html/css and some javascript and I solved the problem about "scrolling too long". But it's ofc still slow.

Proposal

Isn't there some way that I got collapsibles, though, whatever is hidden behind it is not loaded on the page load and only loaded once clicked ? This way, performance will be much better. Thoughts ?

Koooooo-7 commented 1 year ago

Hi @novaknole , I m trying to answer those questions above based on current docsify behaviors.

  1. Does docsify loads content separated from on single .md ?

    Nope, docsify render the single md file to a single page in one time, there is no a simple mechanism to lazy load inside one page. Although it seems not that friendly to big content for now :( .


  1. Does there has a way to make content collapsible ?

Simply, markdown supports it already. i.e.

Click me ### How to make it collapsible Using `
` and `` ```md
Click me Using `
` and `` ### How to make it collapsible ...
```
jhildenbiddle commented 7 months ago

Hi @novaknole.

Have you considered breaking your "quite long" pages into separate pages and/or leveraging the sidebar for efficiently navigating between sections on each page? This seems like the most obvious solution.

Collapsable content is available today as described in @Koooooo-7's comment above.

As for lazy-loading sections of page, this may help with performance issues when loading unusually long pages but it would introduce a number of new issues to consider. My initial reaction is that tackling these issues would add quite a bit of complexity to the page rendering process. Since page rendering performance is not something we hear Docsify users complain about much, I don't see this feature being prioritized any time soon.

For now and the foreseeable future, I think your best option is to revisit your "quite long" pages and break them up into smaller, more manageable content blocks.