docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Collapsible content and lazy loading / rendering.

Open novaknole opened this issue 1 year ago • 1 comments

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:

  • The page is big, so it's slow(kind of lagging)
  • Since page is long, I end up scrolling quite some time to get to the bottom.

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 ?

novaknole avatar Sep 01 '23 15:09 novaknole

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 <details> and <summary>

<details>
  <summary>Click me</summary>
  
  Using `<details>` and `<summary>`
  ### How to make it collapsible
  ...

</details>

Koooooo-7 avatar Sep 05 '23 07:09 Koooooo-7

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.

jhildenbiddle avatar Mar 01 '24 18:03 jhildenbiddle