markdown-viewer icon indicating copy to clipboard operation
markdown-viewer copied to clipboard

Not rendering local .md file despite allowing file:///* URLs and local file URLs

Open Arrow7000 opened this issue 4 years ago • 14 comments
trafficstars

Hi, thanks for creating this extension!

For some reason this isn't rendering markdown for me.

image

I've allowed both file:///* URLs and access to local file URLs as you can see in the screenshot below.

The file URL is file:///C:/Users/Aron/Google%20Drive/today-scratchpad.md

image

Arrow7000 avatar Nov 24 '20 17:11 Arrow7000

Not sure, this should definitely work. Just checked that exact same configuration on Linux and it works. Can you try disabling any/all your other extensions to check if there is incompatibility issues between extensions?

simov avatar Nov 24 '20 19:11 simov

I'm using Windows 10. I've just rebooted my computer and opened the file in Incognito with all other extensions disabled but it's still not working.

image

However it does work in Firefox where I've installed the same extension, so it seems to be a Chrome-only thing.

Arrow7000 avatar Nov 26 '20 15:11 Arrow7000

~~Wait a sec in this case you have to enable the extension in Incognito Mode. By default all extensions are disabled in Incognito Mode.~~

Scratch that I see that you have enabled it, and also I just tested it on my end as well.

simov avatar Nov 26 '20 16:11 simov

So again, that's pretty weird, I don't have any other report regarding issues with Windows and I don't have a Windows machine around to test. The only thing that I can think of besides incompatibility with other extensions is another program registering the .md file extension.

You can easily test that by setting up some random file extension to your file and updating the path matching regexp for the file:/// origin to match it.

simov avatar Nov 26 '20 18:11 simov

I'm trying to do that but:

  1. there isn't a option for the file:/// origin, only https://*, http://* and *://*. I'm guessing the *://* is right, but is it?
  2. I'm trying to add a blamd extension but when I refresh the page the entry just disappears, which doesn't seem right. See the gif for a screen recording. The flash is me refreshing the page. The entry just disappears?

Also it wouldn't make sense to me that the problem is another extension having registered the .md extension, since the same thing happened when I had all other extensions disabled, as in my previous comment.

image

Markdown Viewer (1)

Arrow7000 avatar Nov 27 '20 10:11 Arrow7000

md

You have to enable the extension for file:/// URLs in order to see that option.

simov avatar Nov 27 '20 10:11 simov

Wait a sec, something isn't right with your recording. Certain UI elements are missing. Which version of Chrome do you use? Also which version of the extensions, is it downloaded from Chrome Store?

simov avatar Nov 27 '20 11:11 simov

I have enabled the extension for file:/// URLs. See the screenshot on my initial comment.

This is on the latest version of Chrome, currently v87.0.4280.66. And yes it's from the Chrome store. I didn't sideload it or anything. The extension is version 3.9.

Arrow7000 avatar Nov 28 '20 23:11 Arrow7000

I have the same problem on Chrome Version 87.0.4280.141 (Official Build) (64-bit) running on kubuntu. I have also tried disabling extensions. Oddly, it works on Brave Version 1.18.78 Chromium: 87.0.4280.141 (Official Build) (64-bit) running on kubuntu

wngsy avatar Jan 17 '21 18:01 wngsy

I am using Version 87.0.4280.141 (Official Build) (64-bit) on Ubuntu. It works on Chrome, Chromium, Firefox, Opera and Edge Dev.

simov avatar Jan 17 '21 19:01 simov

On firefox, it would only force a endless 'save dialog' if I try to open a md file from the file system. I followed a work around found for another 'markdown viewer' to get it to work correctly. https://github.com/KeithLRobertson/markdown-viewer#support-for-local-files-on-linux

Chrome still not rendering. I installed the Kubuntu LTS about 4 weeks ago. Used the chrome deb pkg downloaded from the official google page.

wngsy avatar Jan 18 '21 18:01 wngsy

Not Firefox, my bad, I'm glad you found the fix for it. Unfortunately I have no idea why Chrome isn't loading local files in case you have both switches regarding this in the extension's settings turned on.

simov avatar Jan 18 '21 18:01 simov

I had a similar problem with my README.MD file.

My solution was that in advanced origins I edited the local file match. The default version allows these: \.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$ But it does not contain MD extensions written with capitals. So I highly recommend you to add it to this list: \.(?:markdown|mdown|mkdn|md|MD|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$

Maybe it will help others too.

somahargitai avatar Feb 28 '21 22:02 somahargitai

@somahargitai I'm glad you were able to solve your problem but my file has a lowercase .md extension and still doesn't work. 🤷

Arrow7000 avatar Mar 01 '21 16:03 Arrow7000

Here add Allow acces to files URLS works for me !

Manage Extension =

image

SlodeSoft avatar Dec 16 '22 17:12 SlodeSoft

@SlodeSoft I've had that option enabled the whole time. See my initial comment. It still doesn't work for me.

Arrow7000 avatar Dec 17 '22 01:12 Arrow7000

I've got the same problem, but for me it's even slightly weirder. This extension has been working for me and has abruptly just stopped. No extensions added to Chrome in that time.

nello avatar Feb 21 '23 22:02 nello

@nello no recent updates on the extension either. If nothing else works maybe you could try to uninstall/install as a last resort, I read about some issues with the underlying service worker being stuck in manifest v3, which the extension now uses. Just to rule this out.

simov avatar Feb 22 '23 04:02 simov

@simov thanks for the really quick response! Killing Chrome and restarting the Mac fixed it for me. Some extensions were working, including an asciidoc one I regularly use, but this one seemed to have run into difficulties. Sorry for the false alarm!!

nello avatar Feb 22 '23 04:02 nello

I found it necessary to switch Chrome's "Safe Browsing" level (under "Privacy and Security" settings) from "Enhanced" to "Standard." This is in addition to allowing access to file:// URLs, etc.

I'm not sure when it broke (it's been a while), but, with the Safe Browsing change, I got it working again in Chrome Version 114.0.5735.199 (Official Build) (64-bit) on Windows 10.

aidtopia avatar Jul 15 '23 17:07 aidtopia

Not sure why I didn't think of doing this sooner but I looked at the service worker devtools and this is the error I get:

Error handling response: TypeError: Cannot read properties of undefined (reading 'http://127.0.0.1:5500')
    at detect (chrome-extension://ckkdlimhmcjmikdlpkmbgfkaikojcbjk/background/detect.js:85:20)
    at chrome-extension://ckkdlimhmcjmikdlpkmbgfkaikojcbjk/background/detect.js:67:15

This is a screenshot of the debugger when I pause on exceptions:

image

It looks like the error occurs because we're indexing into state.origins, even though state doesn't seem to have an origins field at all

image

Arrow7000 avatar Feb 07 '24 16:02 Arrow7000

I really don't know how you ended up not having origins object in case that is part of the defaults:

https://github.com/simov/markdown-viewer/blob/1b8221a8fbe53f2e0be9f9af7610e61254a06bb6/background/storage.js#L57-L63

Re-installing the extension should definitely fix this.

simov avatar Feb 07 '24 16:02 simov

I removed and reinstalled it but it still didn't work – until I clicked the "defaults" button and then suddenly it worked. So it's fixed now, but I don't know why it didn't work right after reinstallation, even when I gave it all the required permissions

Arrow7000 avatar Feb 08 '24 09:02 Arrow7000