Closed karottenreibe closed 4 years ago
E.g:
The problem is that the search and replace in https://github.com/z3by/vuepress-plugin-flexsearch/blob/b24f602e1b1fcd59b3f78fed0ca1e577830aa90b/SearchBox.vue#L208 does overlapping replacements, i.e. will also replace parts of the inserted html tags.
Code snippet to demonstrate this:
queryWords = ["install", "text"] querySnippet = "install" for (const word of queryWords) { querySnippet = querySnippet.replace(new RegExp(word, 'gi'), `<strong class="text--primary">${word}</strong>`) }
Running this results in
"<strong class=\"<strong class=\"text--primary\">text</strong>--primary\">install</strong>"
(i.e. the "text" of "text--primary" also gets replaced)
I took the liberty to create a pull request to fix this :-)
Thank you for contributing to this package! @karottenreibe 😄
E.g:
The problem is that the search and replace in https://github.com/z3by/vuepress-plugin-flexsearch/blob/b24f602e1b1fcd59b3f78fed0ca1e577830aa90b/SearchBox.vue#L208 does overlapping replacements, i.e. will also replace parts of the inserted html tags.
Code snippet to demonstrate this:
Running this results in
(i.e. the "text" of "text--primary" also gets replaced)