markdown-viewer
markdown-viewer copied to clipboard
Not rendering local .md file despite allowing file:///* URLs and local file URLs
Hi, thanks for creating this extension!
For some reason this isn't rendering markdown for me.

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

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?
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.

However it does work in Firefox where I've installed the same extension, so it seems to be a Chrome-only thing.
~~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.
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.
I'm trying to do that but:
- there isn't a option for the
file:///origin, onlyhttps://*,http://*and*://*. I'm guessing the*://*is right, but is it? - I'm trying to add a
blamdextension 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.



You have to enable the extension for file:/// URLs in order to see that option.
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?
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.
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
I am using Version 87.0.4280.141 (Official Build) (64-bit) on Ubuntu. It works on Chrome, Chromium, Firefox, Opera and Edge Dev.
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.
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.
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 I'm glad you were able to solve your problem but my file has a lowercase .md extension and still doesn't work. 🤷
Here add Allow acces to files URLS works for me !
Manage Extension =

@SlodeSoft I've had that option enabled the whole time. See my initial comment. It still doesn't work for me.
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 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 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!!
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.
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:
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
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.
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