Skip to content

v5 does not generate TOC in sidebar if file name is in Chinese #2706

@a1ess

Description

@a1ess

Description

I created a docsify site using docsify init and replaced the v4 resources with the ones provided for v5.0.0.0-rc4 here.

I set the following options to load _sidebar.md:

<script>
    window.$docsify = {
      name: 'test',
      repo: '',
      loadSidebar: true,
      subMaxLevel: 3
    }
  </script>

Then I created a sidebar to references three documents: two named in English, and one in Chinese:

- [English](english.md)
- [Chinese](chinese.md)
- [中文](中文.md)

Each file contains three headings, like below:

# English

## Heading 1

test.

## Heading 2

test.

### Heading 3

test.

Expected behavior

When clicking on each item in the sidebar, the item should expand and show the TOC for the corresponding page.

Actual behavior

The page TOC is shown only if the file name of the document contains exclusively Latin characters. Clicking on the item pointing to the document named in Chinese opens the document, but does not generate the TOC corresponding to the headings. The TOC is generated correctly using docsify v.4.

Steps to reproduce

  1. Serve the following example site: docs.tar.gz
  2. Click on each item in the sidebar and observe whether the TOC is generated.
  3. Open index.html, uncomment the links that point to the resources of docsify v. 4, and comment out those for v. 5.
  4. Click on the item in the sidebar pointing to the document named in Chinese
  5. Observe that v. 4 generates the TOC correctly.

Environment

  • Linux system running Debian 13
  • Node.js version: v24.14.0
  • Browser: Firefox 149.0
  • Npm version: 11.9.0
  • Docsify version: 5.0.0-rc4

Additional Information

  • [ x] Bug still occurs when all/other plugins are disabled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triagebugconfirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions