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

support plugins with docsify init #98

Closed
tool3 opened this issue Mar 12, 2020 · 11 comments · Fixed by #99
Closed

support plugins with docsify init #98

tool3 opened this issue Mar 12, 2020 · 11 comments · Fixed by #99

Comments

@tool3
Copy link
Contributor

tool3 commented Mar 12, 2020

Hi!

I have been using docsify for some of my projects, and I absolutely love it. even made a github-action out of it for the github action hackathon ;)

I think support for being able to init a docs directory with a list of plugins, maybe loaded from a predefined file or even through cli flags, would be so great, and it will better support docsify in CI/CD.

@tool3 tool3 changed the title support plugins with docsify init support plugins with docsify init Mar 12, 2020
@anikethsaha
Copy link
Member

You meant something like this ?

docsify init -p plugin1, plugin2

by plugin1 and plugin2 I meant relative path to these as this will simply get copied to the template generated ....
something like this !

@tool3
Copy link
Contributor Author

tool3 commented Mar 12, 2020

yeah exactly! so if I do:

docsify init docs/ -p docsify-themeable docsify-tabs docsify

it would create those <script> tags in index.html with those plugins from cdn\local.

I guess options for plugins would mean restricting it to file based only (something like docsify init docs/ -p plugins.json), but that's an implementation decision 😄

@anikethsaha
Copy link
Member

We cant support a config file for the CLI at this point as it would create an confusion for users as the html too has a config object.

Though we can consider this docsify init docs/ -p docsify-themeable docsify-tabs docsify

PoC is Welcome for this

@tool3
Copy link
Contributor Author

tool3 commented Mar 12, 2020

sure I'll have a go

@jhildenbiddle
Copy link
Member

jhildenbiddle commented Jun 17, 2020

Please ensure that docsify plugins versions are locked to the current major version to align with the work done here: #107

To be clear, we don't know the major version of third-party plugins so we can't lock those. I am only referring to plugins within the docsify repo.

@anikethsaha
Copy link
Member

@jhildenbiddle I didnt get this ?

Did you mean any compatibility issue?

@jhildenbiddle
Copy link
Member

jhildenbiddle commented Jun 17, 2020

I mean the following plugins:

https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/

... are all maintained by the docsify team, stored in the same repo as docsify, and therefore designed to work with a specific version of docsify. If we add the ability to specify plugins using the CLI as mentioned above:

docsify init docs/ -p external-script search

We need to lock the plugins loaded to the same major version of docsify:

<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/external-script.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>

Also, I don't think we should tackle loading third-party plugins initially. That gets complicated quickly. For example:

  1. How do we handle plugin URL changes?
  2. How do we verify that a plugin is compatible with the current version of docsify?
  3. How do we know the full list of resources that need to be loaded with a plugin? For example, many plugins require loading separate .js and .css files.
  4. How do we know what configuration options (if any) need to be added in order for the plugin to work properly?

Since the docsify team controls all of the plugins listed above, we know how to answer these questions. With third-party plugins we don't. We could, but it will require coordination with plugin/theme authors.

@anikethsaha
Copy link
Member

I see,
There is an open PR for this #99

I did request the changes you mentioned.

👍

Also, we don't have to think about loading third-party plugins with respect to compatibility issues.
Though currently, we don't have any breaking changes in plugins integration.

@jhildenbiddle
Copy link
Member

Ahh. Didn’t realize there was a related PR in place. Thanks, @anikethsaha.

Regarding the third party plugins, I only mentioned those because docsify-themeable and docsify-tabs were used as example in your example cli command:

Though we can consider this docsify init docs/ -p docsify-themeable docsify-tabs docsify

If third-party plugins aren’t supported by the cli, then no worries. If they are (as the example above implies) then there are additional discussions that need to take place.

@anikethsaha
Copy link
Member

Thats the same I thought , but looking at the PR, it is only implementing only core plugins.

Though we can include third part as well.

cc @tool3

@tool3
Copy link
Contributor Author

tool3 commented Jun 18, 2020

Hi guys!

To support 3rd party plugins which have a custom configuration, obviously this won't work since we don't handle this.

But for 3rd party plugins which have default configurations - this should work 😃

@jhildenbiddle jhildenbiddle linked a pull request Jun 18, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants