Skip to content

support docsify init --plugins - #99

Merged
sy-records merged 32 commits into
docsifyjs:masterfrom
tool3:master
Jun 11, 2021
Merged

support docsify init --plugins#99
sy-records merged 32 commits into
docsifyjs:masterfrom
tool3:master

Conversation

@tool3

@tool3tool3 commented Mar 12, 2020

Copy link
Copy Markdown
Contributor

having a go at #98 .

command: init
option: --plugins, -p

plugins are now supported via the following usage:
docsify init docs/ -p search gitalk <some_other_plugin>

note that by default a plugin will be added as a script tag with a url pointing to https://unpkg.com/docsify/lib/plugins/<plugin_name> otherwise it will use the url provided as an argument.

example and documentation was added to docs/README

@anikethsahaanikethsaha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you removed the main readme ! please revert it .
there are unncessary files like .nojekyll , index.html etc in root. Please check.
please add tests as well

@tool3

Copy link
Copy Markdown
ContributorAuthor

sorry about that! have no idea where those came from 👀

by tests do you mean adding a test to the ava snapshot e2e ?

Thanks !

@tool3

Copy link
Copy Markdown
ContributorAuthor

okay so I added tests but in order to do that I had to change the test structure a bit to accept command help.

let me know what you think 🤘🏼

Comment threadREADME.md
@anikethsaha

Copy link
Copy Markdown
Member

Thanks ! I will review it soon

@anikethsaha
anikethsaha self-requested a review March 13, 2020 09:19
@anikethsahaanikethsaha self-assigned this Mar 13, 2020
@tool3tool3 mentioned this pull request Mar 20, 2020

@anikethsahaanikethsaha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologizes for the delay. Completely lost track of this.

Comment threadlib/commands/init.js Outdated
@jhildenbiddlejhildenbiddle linked an issue Jun 18, 2020 that may be closed by this pull request
@tool3
tool3 requested a review from anikethsahaJune 22, 2020 11:29
@noraj

Copy link
Copy Markdown

@anikethsaha is that possible to re-review?

Comment threadlib/commands/init.js Outdated
replace(target(filename), '_plugins_', '_plugin\n '.repeat(plugins.length))
plugins.forEach(plugin => {
const major = version[0]
const url = plugin.includes('//') ? plugin : `https://cdn.jsdelivr.net/npm/docsify@${major}/lib/plugins/${plugin}.min.js`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if use ./bin/docsify init docs2 -p 1, An exception will be thrown here

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the enquirer in #117, you can use this here as well.

see https://github.com/enquirer/enquirer#multiselect-prompt

@jamesgeorge007jamesgeorge007May 27, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should support specifying a list of plugins as an argument to --plugins such that the prompt shows up on not supplying any or passing in an unsupported plugin.

docsify init [path] --plugins, -p [...plugins]

Comment threadlib/commands/init.js Outdated
Comment threadlib/template/index.html Outdated
Comment threadREADME.md Outdated
Comment threaddocs/README.md Outdated
@sy-records

Copy link
Copy Markdown
Member

resolve #99 (comment) .

When executing the init command, the user may not know which plugins he wants to use and the corresponding plugin names

image

@sy-records
sy-records requested a review from a teamMay 25, 2021 10:39
Comment threadlib/commands/init.js Outdated
@jamesgeorge007

Copy link
Copy Markdown
Member

resolve #99 (comment) .

When executing the init command, the user may not know which plugins he wants to use and the corresponding plugin names

image

The success message should come after the prompt.

sy-recordsand others added 3 commits May 27, 2021 09:35
Co-authored-by: James George <jamesgeorge998001@gmail.com>
@sy-records

Copy link
Copy Markdown
Member

The success message should come after the prompt.

done.

@sy-records

Copy link
Copy Markdown
Member

@jamesgeorge007 Thank you for the modifications 790e96c

But there seems to be some problems:

  1. use ctrl+c , will output the help message

image

  1. use ctrl+c, The docs-test directory is created, but the tip message is missing
Initialization succeeded! Please run docsify serve docs-test/

image

@jamesgeorge007
jamesgeorge007 removed their request for review May 28, 2021 06:10
@jamesgeorge007

Copy link
Copy Markdown
Member

Good catch. I've pushed a fix

@sy-records
sy-records merged commit 8bb295c into docsifyjs:masterJun 11, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support plugins with docsify init

6 participants

@tool3@anikethsaha@noraj@sy-records@jamesgeorge007@QingWei-Li