Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate static HTML site (static site generation, SSG) #136

Closed
acathur opened this issue Mar 17, 2017 · 53 comments
Closed

Generate static HTML site (static site generation, SSG) #136

acathur opened this issue Mar 17, 2017 · 53 comments
Labels
pinned This is to pinned the PR/Issue in order to keep it open PR Welcome ready to implement
Milestone

Comments

@acathur
Copy link

acathur commented Mar 17, 2017

Eagerly waiting for this function, maybe it can be added to docsify-cli.

EDIT by maintainers:

status PR

@QingWei-Li
Copy link
Member

Sorry I don't have time to do now 😣, if you are interested, you can contribute.

@jrappen
Copy link
Contributor

jrappen commented Mar 18, 2017

For comparison, maybe this is a start?

@egoist
Copy link

egoist commented Mar 28, 2017

so why not use gitbook 😄

@jrappen
Copy link
Contributor

jrappen commented Apr 21, 2017

I found madoko:

You can:

  • output static HTML
  • output PDF
  • include files
  • style code in code blocks

@egoist
Copy link

egoist commented Apr 21, 2017

@jrappen that looks cool, but seems it does the same things that gitbook can do

@dietergoetelen
Copy link

@QingWei-Li I'm new to docsify, would love to see this feature. I'm interested in contributing, can you point me in the right direction?

@egoist
Copy link

egoist commented May 31, 2017

@dietergoetelen Seems the SSR API can achieve this https://docsify.js.org/#/ssr?id=deploy-for-your-vps

@QingWei-Li
Copy link
Member

Hi @dietergoetelen,
Now part of the compiler can run in Node, you can refer to docsify-server-renderer. We can read the files and then compile them like docsify-server-renderer do the same. Would you like to try it?

@maoueh
Copy link

maoueh commented Feb 27, 2018

@QingWeil-Li Was this close because it's now possible? Won’t fix?

@QingWei-Li
Copy link
Member

@maoueh

GitBook is recommended if you need to build static files.

@luishdez
Copy link

But GitBook is a paid product, It's only free for "non private" projects. Can we at least leave the PR Welcome?

@gottlike
Copy link

@QingWei-Li

A really simple solution would be to just add a print-css and reference the browser print function with a simple button (printing to PDF can then be chosen by the user). What do you think?

@KerimG
Copy link

KerimG commented Aug 13, 2018

+1 on the feature request.

@QingWei-Li QingWei-Li mentioned this issue Oct 28, 2018
5 tasks
@sheljohn
Copy link

sheljohn commented Nov 2, 2018

@jrappen I stumbled upon Madoko a while back. The main issue with it is that it is written in Koka, which no one knows apart from its author Daan Leijen, who is also the author of that package. For a while it was hosted on CodePlex, and it was really difficult to find the sources, let alone understand them, or contribute. I suppose this is now on GitHub because MS acquired the company... The reference manual looks absolutely amazing, and it's difficult to think that only one person is behind this; but IMO that summarises the project well. It looks awesome, but it's a black-box, written in sanskrit, with a single contributor.

@egoist Have a look at the reference manual; it serves a different purpose than GitBook. Madoko was designed to write scientific publication-like content; it supports LaTeX maths, internal references, citations, and footnotes out of the box. GitBook is meant to be an advanced documentation-writing tool, oriented towards web-publishing. Let us not compare pears and apples.

@weituotian
Copy link

@QingWei-Li can it output pdf? need!

@ideacco
Copy link

ideacco commented Dec 19, 2018

+1 on the feature request.

@yhhwpp
Copy link

yhhwpp commented Dec 5, 2019

+1 on the feature request.

@justerhan
Copy link

https://github.com/egoist/presite might be useful here

@trusktr
Copy link
Member

trusktr commented May 21, 2020

SSR generates HTML, so we're pretty close to accomplishing the first version of this already.

We can just have it output HTML to the file system instead of to the client. We can use a simple crawler that crawls every link and for every link it can output each page to the filesystem using the Renderer from docsify-server-renderer.

Even without plugins, this can give us exactly the same result as we see at https://docsify.now.sh (but static instead of SSR).

With jsdom in place the DOM (although it is faked) will exist in order for plugins to use it. Plugins should work fine unless they do something extravagant like use WebGL or some brand new DOM APIs that aren't implemented yet.

We can write in the documentation how to test plugins for all three environments; SSR, Static, and real browser.

@trusktr
Copy link
Member

trusktr commented May 21, 2020

Another idea: once we have the filesystem output, the same crawler can also index everything for the search results, and save it as static JSON that the client can fetch.

@anikethsaha
Copy link
Member

anikethsaha commented May 21, 2020

I don't think plugins works in SSR.

Not sure though, I need to give it a test.

Happy to accept POC for this.

@anikethsaha
Copy link
Member

I had the idea of rendering the main in jsdom and output the rendering in an HTML file.

@trusktr

This comment has been minimized.

@trusktr

This comment has been minimized.

@jhildenbiddle

This comment has been minimized.

@stale
Copy link

stale bot commented Aug 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 21, 2020
@trusktr trusktr changed the title Can docsify generate static files? Generate static HTML site (static site generation, SSG) Aug 21, 2020
@stale stale bot removed the wontfix label Aug 21, 2020
@sy-records sy-records added the pinned This is to pinned the PR/Issue in order to keep it open label Aug 22, 2020
@qmjy
Copy link

qmjy commented Sep 9, 2020

I'm looking forward to it. 👍

@itymarcel
Copy link

Also looking forward to it. Is there any reason why this hasn't been merged yet? Thank you for working on this it's an amazing tool!

@MattRiddell
Copy link

MattRiddell commented Dec 14, 2021

Adding my voice to this - would make it a lot easier for me to get this deployed as a tool as I'd be able to send generated files to our documentation hubs.

EDIT: Sorry, also forgot to say what an awesome tool this is and how long I've been searching for something that fills my needs the way this does. I've used a tonne of documentation tools and this one aligns with my thought process and development methods by far the best. Doesn't hurt that the output is gorgeous too!

@juukee
Copy link

juukee commented Feb 19, 2022

so when can we use it?

@weituotian
Copy link

weituotian commented Feb 19, 2022 via email

@hefengliang
Copy link

so when can we use it?

@BryanYin
Copy link

Is there any reason why this hasn't been merged yet? Thank you for working on this it's an amazing tool!

@trusktr
Copy link
Member

trusktr commented Aug 10, 2022

It was experimental and didn't reach a state of being ready.

But! I'm interested in another plan:

I'd like to get Docsify to use Solid.js (I've been working with the Solid team) for its built-in and fast SSR and SSG capabilities. This involves first re-writing Docsify internals as Solid components. I started that work in the dom-with-solid branch here:

develop...dom-with-solid

As you can see there, some internal code is getting cleaner, for example this code,

function mainTpl(config) {
  let html = `<nav class="app-nav${
    config.repo ? '' : ' no-badge'
  }"><!--navbar--></nav>`;

  if (config.repo) {
    html += tpl.corner(config.repo);
  }

  if (config.coverpage) {
    html += tpl.cover();
  }

  html += tpl.main(config);

  return html;
}

was changed to

function mainTpl(config) {
  return (
    <>
      <nav
        class={`app-nav${config.repo ? '' : ' no-badge'}`}
        innerHTML={'<!--navbar-->'}
      ></nav>

      {config.repo && (
        <GithubCorner
          githubUrl={config.repo}
          cornerExternalLinkTarget={config.cornerExternalLinkTarge}
        />
      )}

      {config.coverpage && <Cover />}

      <Main {...config} />
    </>
  );
}

where GithubCorner, Cover, and Main are also components, all with a more modern reactive-declarative paradigm.

Besides SSR and SSG, this will allow us to more easily implement features like custom templates in a nice way. Imagine browsing a collection of templates to choose from (not just CSS themes), each with unique functionalities.

Up next I will remove the existing SSR implementation (in that branch, or a new branch based on that branch) because it has issues with plugins, and fixing that would be some work that would need to be totally replaced with the Solid SSR approach anyway (and I don't want to spend time working on two things when I can work on just one).

I'm also not sure that the team will approve of this direction. In that case I will be willing to make a fork to continue working on it there.

@sergeiromanov
Copy link

docsify looked so perfect for my case until I realized it doesn't generate static html :(

@weituotian
Copy link

weituotian commented Oct 3, 2022 via email

@mandrasch
Copy link

Just a quick thought: Could docsify be coupled with eleventy (https://www.11ty.dev/) or astro (https://astro.build/)? Guess for some use case (https://github.com/hibbitts-design/docsify-open-course-starter-kit for example) working without npm and without a build pipeline is a key feature of docsify. But for users wanting to have static output a (technical) bridge to eleventy or astro would be maybe an option as well? 🤔

@scruel
Copy link

scruel commented Mar 24, 2023

I don't think this would be necessary, for crawlers, we can just provide them the hidden URLs which will redirect to markdown file directly?

@weituotian
Copy link

weituotian commented Mar 24, 2023 via email

@jhildenbiddle
Copy link
Member

Docsify may someday offer static site generation, but given the myriad of alternatives offering SSG it seems best for Docsify to continue focusing on its client-side site generation abilities.

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned This is to pinned the PR/Issue in order to keep it open PR Welcome ready to implement
Projects
None yet
Development

No branches or pull requests