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

Display any pictures #65

Closed
pyrog opened this issue Nov 24, 2020 · 4 comments
Closed

Display any pictures #65

pyrog opened this issue Nov 24, 2020 · 4 comments

Comments

@pyrog
Copy link
Contributor

pyrog commented Nov 24, 2020

Add a regex like this one to linkily.js ?
(http(s)?://)?(www.)?.*.(jpg|jpeg|png)

Example: note 2439467

@ArcaneDots
Copy link

All the links on example note and it's comments are accessible, What is wrong with the current regex? Any existing issues with it should be linked here.

@Lee-Carre
Copy link

@ArcaneDots

I believe the idea is to have URLs pointing to images be not merely rendered as a link, but to display (a thumbnail of) the image itself, when displaying the note.

@Lee-Carre
Copy link

@pyrog

(http(s)?://)?(www.)?.*.(jpg|jpeg|png)

Interesting tool (bookmarked), but sub-optimal regex. Instead:

/^(?:https?:\/\/)?(?:www\.)?[0-9a-zA-Z%\/@\-\_\;\.\&\+\=]+\.(?:jpe?g|png|webp)/i

If you compare, using the same tool, you'll notice that the execution time is considerably less (and it'll use less memory, too).

This pattern could be refined further, in a bunch of ways, to be more specific (to well-formed URLs).

Somewhat moot, now, due to my PR.

Reference site: Regular Expressions.

@Lee-Carre
Copy link

This pattern could be refined further, in a bunch of ways, to be more specific (to well-formed URLs).

(?:https?:\/\/)?(?:www\.)?(?:[\w\-]+\.)*(?:[\w\-]+)\.(?:[a-z]{2,})\.?\/(?:[\w\/]+)\.(gif|tiff?|jpe?g|[pm]ng|svg|webp)

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

3 participants