Cimbali / markdown-viewer

Markdown (.md) file viewer WebExtension for your browser.
Other
165 stars 28 forks source link

Does not activate on web files (Firefox, Windows) #82

Closed jacktose closed 3 years ago

jacktose commented 3 years ago

Is this extension supposed to work on markdown files hosted on the web? I assume so, because there's nothing to the contrary in the readme or existing issues.

When I load a .md file from a file:// URL, it renders nicely. When I open it from an http[s]:// URL (example), it displays as plain text, with no extension menu. Here's an example from a fresh install in Windows Sandbox: md-remote

Windows 10 19043.1165, Firefox 91.0.1

Cimbali commented 3 years ago

That’s ony on githubusercontent I think, where the content-security-policy explicitely forbids it. See the headers:

content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox

See for example this raw markdown file from a gitlab repo. Other markdown files in the wild should work too − and those on github already have a rendered version.

Cimbali commented 3 years ago

It’s actually said (briefly) in the README, with that specific example:

To keep it simple, the extension does not support on and off states. If the document has one of the supported extensions, it should convert. Some web sites however, like raw.githubusercontent.com, return CORS headers, in which case Firefox will not inject this extension's content scripts, so it cannot convert the document.

jacktose commented 3 years ago

Oops, bad luck with choice of test specimen, and a big RTFM to me. Thanks.