docs: Adds instructions to upgrade custom plugins to v5 - #2788
docs: Adds instructions to upgrade custom plugins to v5#2788julienbusset wants to merge 3 commits into
Conversation
…ement) Adds instructions to replace the toggleClass function in custom plugins, because this function doesn't exist anymore in v5. Instructions written in the "Upgrading" / "v4 to v5" section.
|
@julienbusset is attempting to deploy a commit to the Docsify Team on Vercel. A member of the Team first needs to authorize it. |
|
@sy-records , you may be interested, aren't you? |
|
Thanks very much for the PR @julienbusset ! In terms of placement, it is really not a "Step 5" item - at least for most readers of the guide. I would suggest making it more of a note for plugin developers, perhaps something more along these lines: Zoom Plugin: <!-- v4 -->
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
<!-- OR non-versioned: -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<!-- v5 -->
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/zoom-image.min.js"></script>Note: If you're using additional Docsify plugins (such as emoji, external-script, front-matter, etc.), you'll need to update those URLs as well following the same pattern:
Plugin Authors: If you've written a custom plugin that uses The Examples: // v4
window.Docsify.dom.toggleClass(element, 'className');
// v5
element.classList.toggle('className');// v4
window.Docsify.dom.toggleClass(element, 'action', 'className');
// v5
element.classList.action('className');// v4
window.Docsify.dom.toggleClass(element, isDark ? 'add' : 'remove', 'dark');
// v5
element.classList[isDark ? 'add' : 'remove']('dark');Key Differences Summary |
…doc hierarchy Took paulhibbitts' relevant remarks in PR docsifyjs#2788 into account: changed the position of the chapter about the toggleClass removal in v5 to a lower rank.
|
Thanks @paulhibbitts , I took your relevant remark into account + removed duplicated content between your proposal and mine. Please take a look at it. |
paulhibbitts
left a comment
There was a problem hiding this comment.
Thanks for making those updates @julienbusset! LGTM.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| - Update version from `@4` (or non-versioned) to `@5` | ||
| - Example: `//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js` becomes `//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/emoji.min.js` | ||
|
|
||
| **Plugin Authors:** If you've written a custom plugin that uses `window.Docsify.dom.toggleClass`, this helper has been removed in v5. Replace it with the native `Element.classList` API. |
There was a problem hiding this comment.
| **Plugin Authors:** If you've written a custom plugin that uses `window.Docsify.dom.toggleClass`, this helper has been removed in v5. Replace it with the native `Element.classList` API. | |
| #### Plugin Authors | |
| If you've written a custom plugin that uses `window.Docsify.dom.toggleClass`, this helper has been removed in v5. Replace it with the native `Element.classList` API. |
There was a problem hiding this comment.
Hmmm... I hope I didn't make a mistake by applying @sy-records 's change...
It also says that the branch needs a rebase on the base branch: does it? May I rebase. I need your lights.
|
Lint CI requires fixes |
Co-authored-by: Luffy <52o@qq52o.cn>
Summary
Adds instructions in documentation to replace the toggleClass function in custom plugins, because this function doesn't exist anymore in v5. Instructions written in the "Upgrading" / "v4 to v5" section.
Is important because the toggleClass removal broke some plugins (like docsify-dark-switch).
Related issue, if any:
None, because if an issue should be declared, then it must be declared in plugin's repo.
What kind of change does this PR introduce?
For any code change,
Does this PR introduce a breaking change?
Tested in the following browsers: