-
Notifications
You must be signed in to change notification settings - Fork 123
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
Better default titles in search: Remove file format ending #1826
Merged
ryoarmanda
merged 5 commits into
MarkBind:master
from
kaixin-hc:remove-index-from-search
Mar 19, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9974a38
Add files which should not be searchable
kaixin-hc f339d50
Merge branch 'master' into remove-index-from-search
kaixin-hc f0e0bc2
remove file ending in search
kaixin-hc 129f2ff
Remove suffix from last period
kaixin-hc c882717
Change method to more intuitive one
kaixin-hc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although not a major issue considering how the normal situation would be like, this would give unexpected results when the file has no extensions (
index
would be presented as an empty string) or "double" extensions (index.tar.gz
would be presented asindex.tar
)The latter case seems a bit unlikely to be passed on in normal development situation so I guess it's okay to not cover that (let me know if you feel otherwise though!), but it's good fault-tolerance if we can handle the former case, so it still returns the file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the latter case, If there is a file of type
.tar.gz
, will the search check the content of such files, or, will it be useful for the search to check the content of such files? I am guessing not really, so I think it is fine since typical files that we are getting the content from are.md
or.html
.Not too sure about the search implementation and hence cant comment on the formal case/other possible cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have delved in a little bit on how we include pages and the search, and looks like the latter case (and probably the former too) can be reasonably ignored 😅
Search data comes from
siteData.json
, which is written bySite
, that includes data fromSite.pages
, which in turn is collected fromsite.json
properties (pages
,globs
, and the likes). I guess we can reasonably believe that search results come from page files and not any arbitrary file. As our page files are of the normal extension form (.md
and.html
), then we can assume that the latter case would not happen.By extension (heh), the former case shouldn't really happen as well. But I still think it's good to be safe rather than encountering a case where the result are empty strings one day. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated this suggestion more as well, and found the following code in NodeProcessor.
In other words, MarkBind only supports
.html
or.md
. If you deliberately include a 'page' which doesn't have a supported file format ending, theUnsupported File Extension:
error is thrown and the website cannot build at all.So I think both the former and the latter case are invalid inputs that will safely never happen under the current implementation 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the deeper investigation @kaixin-hc, we can safely use this implementation then 😄