Skip to content
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

Strip Surrounding Quotation Marks from Filepaths (and URLs?) #60

Open
CDWimmer opened this issue Aug 13, 2024 · 0 comments
Open

Strip Surrounding Quotation Marks from Filepaths (and URLs?) #60

CDWimmer opened this issue Aug 13, 2024 · 0 comments

Comments

@CDWimmer
Copy link

CDWimmer commented Aug 13, 2024

Howdy,

Most of the time in Obsidian I'm working with file:/// paths out of the browser, of which paste nicely :)
i.e.
file:///V:/2022 Trading Calendar.xlsx pasted into a selection makes a nice enough result:
[some text](<file:///V:/2022 Trading Calendar.xlsx>)

However, it's sometimes far more convenient to grab a file path from Explorer, which does not care to emit URL formatting.

On Windows, if you hold shift when right-clicking in Explorer, a file and select "Copy as path" you are given a quote-wrapped path in Windows format, with back-slash separators and spaces are spaces.
i.e. for the same file as before, "V:\2022 Trading Calendar.xlsx" is the full string copied.

Pasting this over the text "some text" results in: [some text](<"V:\2022 Trading Calendar.xlsx">)

Windows (and presumably other non-browser systems) adds the quote marks to paths with spaces so that in the shell it understands when a path with spaces starts and ends. The < > wrapping achieves this for us in Markdown.

Clicking this causes an error in Obsidian as it tried to URL-encode the leading quotation mark into %22, which is obviously not a valid way to start a URL.

Removing the quotes allows Obsidian to turn it into a proper file:/// URL:
[some text](<V:\2022 Trading Calendar.xlsx>):
image

It would be very much a welcomed convenience if this could detect and strip of a pair of leading/trailing quotation marks around a URL or a file path such that Obsidian will generate valid URLs from it without modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant