Skip to content

Have a BUG in scroll.js #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
vagra opened this issue Apr 20, 2020 · 4 comments
Closed
1 task

Have a BUG in scroll.js #1127

vagra opened this issue Apr 20, 2020 · 4 comments

Comments

@vagra
Copy link
Contributor

vagra commented Apr 20, 2020

Bug Report

Steps to reproduce

have a BUG in scroll.js

this BUG cause:

if path and id include chinese character, it can't find some result from the nav[].

What is current behaviour

export function scrollIntoView(path, id) {
  if (!id) {
    return;
  }
  const topMargin = config().topMargin;
  const section = dom.find('#' + id);
  section && scrollTo(section, topMargin);

  const li = nav[getNavKey(path, id)];

What is the expected behaviour

last line shoule changed to:

  const li = nav[getNavKey(decodeURIComponent(path), decodeURIComponent(id))];

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS:

  • Node.js version:

  • npm/yarn version:

  • Browser version:

  • Docsify version:

  • Docsify plugins:

Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

@vagra
Copy link
Contributor Author

vagra commented Apr 22, 2020

when the .md file name include chinese character:

console.log(path);
console.log(id);

result:

/docs/%E6%A5%9E%E4%B8%A5%E7%BB%8F%EF%BC%88%E4%BE%9D%E5%9C%86%E7%91%9B%E6%B3%95%E5%B8%88%E8%AE%B2%E4%B9%89%EF%BC%89
乙一、序分
console.log(decodeURIComponent(path));
console.log(decodeURIComponent(id));

result:

/docs/楞严经(依圆瑛法师讲义)	
乙一、序分

@vagra
Copy link
Contributor Author

vagra commented Apr 22, 2020

this problem cause:
if .md file include chinese characters, when click at the heading in main content, the sidebar links can't highlight and sync scroll.

because const li = nav[getNavKey(path, id)] have not result.

@anikethsaha
Copy link
Member

we need to check whether this change will cause side effects or not.
feel free to investigate and submit a fix.
Just a note that we don't have a strong test so we should check manually whether other things are breaking cause of this or not.

vagra added a commit to vagra/docsify that referenced this issue Apr 24, 2020
This was referenced Apr 24, 2020
anikethsaha added a commit that referenced this issue May 3, 2020
@anikethsaha
Copy link
Member

fixed at #1146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants