-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Glossary not support non-english character #312
Labels
Comments
Maybe, this
function pregQuote(str) {
return `${str}`.replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
}
const name = "Brancaleone von Andalò";
const searchRegex = new RegExp(`\\b(${pregQuote(name.toLowerCase())})\\b`, "gi");
console.log(searchRegex.test("test Brancaleone von Andalò test")); // => false
|
@azu Great! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
more precisely, it could not support glossary term with non-word character on heading or trailing, e.g.
Connétable
could be matched, butBrancaleone von Andalò
failed. If one term starting with(
or ending with)
, it could not be matched either. Actually, words with special character are so common in glossary, especially in books of other language(french, german, japanese).also an old bug since gitbook, hope it could be fixed. I think the root case of #233 is the same.
Step to reproduce
Brancaleone von Andalò
in GLOSSARY.mdBrancaleone von Andalò
in paragraph of one page fileExpected results
Brancaleone von Andalò
in article could be a glossary link.Actual results
no link created.
The text was updated successfully, but these errors were encountered: