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

WebP, SVG and Placeholder Video Thumbnail Support. #49

Closed
setanarut opened this issue Jan 18, 2021 · 13 comments
Closed

WebP, SVG and Placeholder Video Thumbnail Support. #49

setanarut opened this issue Jan 18, 2021 · 13 comments

Comments

@setanarut
Copy link
Contributor

I know, Github's README.MD does not support inline SVG , WebP and videos. Maybe features specific to macOS can be considered.

The Quick Look HTML preview supports the following;

  • SVG
  • WebP (Animated and Static)
  • Placeholder Video Thumbnail

QLMarkdown cannot display the following;

Inline HTML

  • WebP (Animated and Static) - <img src="image.webp" alt="">
  • Placeholder Video Thumbnail - <source src="video.mov" type="video/mp4">

Markdown

  • SVG - ![SVG](image.svg)
  • WebP - ![WEBP](image.webp)

Note: Embedded webp is not displayed. <img src="data:image/webp;base64........

Ekran Resmi 2021-01-18 03 54 38

@sbarex
Copy link
Owner

sbarex commented Jan 18, 2021

The .svg and .webp images are in the same folder of the markdown file?
On my mac the svg and webp preview works.

In the app editor if you write by hand the code the images are searched from the resource bundle of the app. Otherwise if you open an .md file, the basedir is the folder of the .md file.

@setanarut
Copy link
Contributor Author

setanarut commented Jan 18, 2021

The .svg and .webp images are in the same folder of the markdown file?
On my mac the svg and webp preview works.

In the app editor if you write by hand the code the images are searched from the resource bundle of the app. Otherwise if you open an .md file, the basedir is the folder of the .md file.

Yes, The .svg and .webp images are in the same folder. I tested every condition, it doesn't work for me.

Ekran Resmi 2021-01-19 01 08 21

![test](./test.svg)

@sbarex
Copy link
Owner

sbarex commented Jan 19, 2021

Can you share the .md and .svg file?

@setanarut
Copy link
Contributor Author

@sbarex
Copy link
Owner

sbarex commented Jan 20, 2021

Please try release 17.

Regarding the preview of the videos I don't think to implement it. Security restrictions prevent you from accessing video files from the quick look preview.
An extension should be created that analyzes the .md file looking for html code containing a video, reads the file, obtains the preview and inserts it in the formatted html code...
Moreover Apple does not directly manage many video formats (webm, mkv, avi, ...) and you should use external libraries such as ffmpeg.
A lot of work for a non-standard functionality for the .md language.

@setanarut
Copy link
Contributor Author

setanarut commented Jan 20, 2021

Please try release 17.

Regarding the preview of the videos I don't think to implement it. Security restrictions prevent you from accessing video files from the quick look preview.
An extension should be created that analyzes the .md file looking for html code containing a video, reads the file, obtains the preview and inserts it in the formatted html code...
Moreover Apple does not directly manage many video formats (webm, mkv, avi, ...) and you should use external libraries such as ffmpeg.
A lot of work for a non-standard functionality for the .md language.

Thanks, video thumbnails is not important. SVG fixed but WEBP is still not displayed. ![test](./webp_test.webp)

@setanarut
Copy link
Contributor Author

setanarut commented Jan 20, 2021

Quick Look doesn't play animated webp by default. I think QLMarkdown should show static WebP.

@sbarex
Copy link
Owner

sbarex commented Jan 20, 2021

In the terminal, what is the output of this command?

$ file --mime-type PATH_OF_WEBP_FILE

It should be image/webp.
Also, if the QLMarkdown app in on the Applications folder try this command:

file --mime-type -m /Applications/QLMarkdown.app/Contents/Resources/magic.mgc PATH_OF_WEBP_FILE

The result should always be image/webp.

Can you provide a webp animated file?

@setanarut
Copy link
Contributor Author

➜  Desktop file --mime-type ./webp_test.webp                   
./webp_test.webp: image/webp
➜  Desktop file --mime-type -m /Applications/QLMarkdown.app/Contents/Resources/magic.mgc ./webp_test.webp 
./webp_test.webp: image/webp

webp images
https://developers.google.com/speed/webp/gallery1

@sbarex
Copy link
Owner

sbarex commented Jan 21, 2021

on release 18 should be fixed (also support for animated .webp).

@setanarut
Copy link
Contributor Author

setanarut commented Feb 13, 2021

@sbarex SVG works if this option is selected. but this is not inline HTML code -> ![test](./test.svg). This is a valid Markdown syntax. This is confusing for the end user. Indicates that these options are unreliable.

Ekran Resmi 2021-02-14 02 17 47

@sbarex
Copy link
Owner

sbarex commented Feb 14, 2021

This behavior is caused by cmark.

When html content is not allowed, it automatically performs a series of extra checks in search of dangerous content. For the images, it checks their url, removing any it thinks are not safe. In the case of the data: scheme (used to embed the image file inside the html output preventing the security limitation of the Quick Look engine) only these mime types are allowed: image/png image/gif, image/jpeg, image/webp.

@setanarut
Copy link
Contributor Author

I think, you should write this in the documentation. --> "This option must be selected for SVG preview" Ekran Resmi 2021-02-14 02 17 47

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

2 participants