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

[Feature request] embed docsify on third party site #799

Closed
dur41d opened this issue Mar 27, 2019 · 8 comments
Closed

[Feature request] embed docsify on third party site #799

dur41d opened this issue Mar 27, 2019 · 8 comments

Comments

@dur41d
Copy link

dur41d commented Mar 27, 2019

Docsify is great but I find I can only use it in a dedicated website. It would be more flexible if docsify can be embedded on other sites. Although it's possible in theory but in practice I found that it doesn't work well.

For example: I wanted to use docsify to generate the documentation on this site:

https://uis-azr-test-fusionapi-eus1.portal.azure-api.net/user-guide-2

When I embedded docsify into the html if found that it completely changed the layout of my website. I think one of the reasons is that it modified the nav of the website.

I ended up using flatdoc which doesn't have the same features but it's less intrusive on the host website.

@trusktr
Copy link
Member

trusktr commented Jun 21, 2020

This would be great to make this easier (f.e. not overriding existing <nav>)

@trusktr
Copy link
Member

trusktr commented Jun 21, 2020

With the refactors that I recently did to move Docsify into its own file that has no side-effect of automatically loading Docsify into the DOM (see src/core/Docsify.js), I can imagine a simple way to do this initially as a non-breaking change (no custom element in this case), so I'll put it in 4.x.

Basically, we just tell Rollup to compile an additional bundle using src/core/Docsify.js as the entry point. In this case, the user can place a script tag pointing to this new bundle and manually instantiate new Docsify, while the previous bundle will still exist so all existing sites work the same way.

Users of the new bundle will be able to do this:

new Docsify({
  el: '#somewhere',
})

This will be very handy for integrating into existing websites while keeping them single-page apps, for example.

@pauldraper
Copy link

Any hope for this?

@pauldraper
Copy link

There are a number of issues with using docsify as a component.

For example, it registers global handlers when setting up routing.

That is, teardown will be a problem. (And I think it might even interfere with existing <a> on the page.)

@trusktr
Copy link
Member

trusktr commented Jan 12, 2022

Let's list the things we need to fix right now to get this is good enough shape with minimal changes (bigger changes for later):

it registers global handlers when setting up routing.

@pauldraper Can you expand on this? Would you like Docsify to perform routing internally without modifying the URL path (because the outer application is doing that)? Or you still want the same behavior, but with ability to teardown when switching away from a docsify-containing view?

@pauldraper
Copy link

Modifying the URL path is fine (for me at least).

But I do need to teardown listeners, or at least not cause a memory leak by double registering them.

I haven't looked at the implementation.

@paulhibbitts
Copy link
Collaborator

This is now possible with https://Docsify-This.net which is open source and can be further customized including hosting your own instance, so closing this issue.

@onionhammer
Copy link

onionhammer commented Mar 17, 2024

Docsify-this, unless I'm misunderstanding what "docsify-this" does (generate a complete public website based on public markdown files), feels somewhat like the opposite of what this issue is requesting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants