Closed kdheepak closed 2 years ago
Thanks for the detailed report! I'll look into this and see if I can make improvements here. As far as I know, this bug is coming into play because there's a hyphen in the word being searched, and some parts of Stork treat a hyphen as a word separator (like a space) whereas others do not.
It's possible it is related to hypens, but it also occurs elsewhere. For example, if I search for vimrc
:
It always occurs for text in <mark></mark>
tags.
Ah - might be more than just hyphens, might be all punctuation.
I'll take a look.
Thanks! Great job on stork btw!
I'm not sure if this was fixed and just hasn't been released yet. But I figured I'd report since it was related to this issue. When I go to https://blog.kdheepak.com and search for julia
I get this:
I think it has to do with unicode lengths. That particular blog post (https://blog.kdheepak.com/my-unicode-cheat-sheet) has a number of very interesting edge cases, and if you aren't using https://github.com/unicode-rs/unicode-segmentation to calculate length of the strings / slices, you might not be covering those corner cases. I see unicode-segmentation
in the dependencies but I didn't go through the code to figure out what might be the problem.
This has been fixed in #297! It'll be released in version 1.5.0, which will be released as soon as I get a moment where I have time to do so!
Awesome! No hurry on my end!
I'm using the latest
stork
This is an example of the snippet in the search result when the search query is "neovim":
You can see that when backticks are involved, the
mark
seems to exclude the last letter of the search result:The end result is some rather old highlighting. This is what it looks like when I'm not showing the console highlighting:
For reproducing this, you can find a link to the
.st
file here:https://github.com/kdheepak/blog/blob/9e8c45bc90395d05cc610c82f44d6926d4eda7f4/static/assets/stork/search.st
You can also download it here:
https://blog.kdheepak.com/assets/stork/search.st
The code I'm using is all standard, based on the documentation: https://github.com/kdheepak/blog/blob/9e8c45bc90395d05cc610c82f44d6926d4eda7f4/src/lib/components/Search.svelte
And I'm loading stork from the CDN as shown in the documentation:
https://github.com/kdheepak/blog/blob/9e8c45bc90395d05cc610c82f44d6926d4eda7f4/src/app.html#L7
You should be able to see a live version of this bug in action here: https://blog.kdheepak.com/. Scroll to the bottom and you'll be able to find the search bar.