Enable opening non md files #7
Merged
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.
Problem
Current implementation force-appends
.md
to all paths, preventing users from opening PDFs, images, or other supported file types.Solution
Check for existing file extension before defaulting to
.md
. Simple regex test preserves backward compatibility while enabling broader file support.Changes
/\.[^.]+$/
regex.md
when no extension presentTested with:
note.md
,note
,image.png
,doc.pdf
Limitations
Doesn't auto-resolve to existing non-md files when extension omitted. E.g.,
openNote('myfile')
won't findmyfile.pdf
- still defaults to searching formyfile.md
. Full path with extension required for non-markdown files, which may be preferred use pattern.