docs: Adds instructions to upgrade custom plugins to v5 - #2788
docs: Adds instructions to upgrade custom plugins to v5#2788julienbusset wants to merge 2 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. |
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: