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

Rendering does not work on Firefox

Open rovf opened this issue 2 years ago • 17 comments
trafficstars

I have installed the Addon "simov/markdown-viewer" on Firefox 113.0.1, running on MacOS 12.6.5

When opening a MD-file (name: playground.md) using File/Open, I get two options:

  • store the file
  • open it with MarkEdit

Since I don't want to store the file (after all, it is on disk already), and I happen to have MarkEdit installed (version 1.6.2), I used the latter. MarkEdit is then started and the file loaded, but not rendered (MarkEdit does not support a preview).

rovf avatar May 24 '23 10:05 rovf

Can you verify that the local file access is enabled for the extension in the advanced options page?

It should look like this if enabled correctly: Screenshot from 2023-05-24 13-54-50

In case the box is highlighted with a red color then click on the refresh button.

If all looks good then maybe you are having some mime type misconfiguration issues on your machine. I don't have any other reports of local file URLs not loading on MacOS as that is a known issue on linux for example.

simov avatar May 24 '23 10:05 simov

It looks the same. Actually, thes settings were already the default. BTW, I found that the Chrome version for this extension suffers a similar problem. The difference is that the Firefox extension starts the App "MarkEdit" to show the file, while the Chrome version simply shows the unrendered file in a browser tab.

rovf avatar May 24 '23 11:05 rovf

That's even more strange, can you verify that all of the points outlined here are looking good on Chrome on your end?

simov avatar May 24 '23 12:05 simov

~~Same behaviour here~~:

  • macOS 13.3.1 (a) (22E772610a)
  • Firefox 113.0.2 (64-bit)

Opening a .md file stored on disk using its file:/// URL shows the plain text. Nothing in the console.

Interestingly, the favicon is replaced by the Markdown Viewer icon: Screenshot 2023-05-25 at 16 15 20

Edit: whoops, I toggled the HTML/Markdown button in the extension panel and it seems to work now. Sorry!

roberto-red avatar May 25 '23 14:05 roberto-red

whoops, I toggled the HTML/Markdown button in the extension panel and it seems to work now.

Where is this panel? Do you mean in the Preferences of Firefox? I don't see such a button there.

rovf avatar May 25 '23 14:05 rovf

I mean the webextension preferences, right in the Firefox toolbar:

Screenshot 2023-05-25 at 16 29 22

roberto-red avatar May 25 '23 14:05 roberto-red

Ah, the first time I noticed this panel! But it did not help: I toggled the settings to HTML and back to MARKDOWN, and still when I open a .md file, Firefox starts the program MarkEdit for me, loaded with this file.

rovf avatar May 26 '23 05:05 rovf

That's even more strange, can you verify that all of the points outlined here are looking good on Chrome on your end?

Found it! "Allow access to file URLs" was turned off. Now I turned it on, and it works in Chrome!! Only Firefox does not work yet....

rovf avatar May 26 '23 05:05 rovf

@rovf most likely an external application (MarkEdit) has updated your mime types config file for Firefox on MacOS resulting in Firefox no longer rendering it as plain text by default and instead showing that popup to either download it or open it with an external app. This would explain why the extension works for some users (roberto-red) on MacOS, but not for others as in your case.

As mentioned earlier, on Linux it is the other way around - access to local files does not work by default and therefore it is a known issue. I'm assuming that updating the mime types for Firefox on MacOS should be similar, but there is no way for me to validate that. Also, it seems other people on the internet are having similar issue but I couldn't find a definitive answer either.

simov avatar May 26 '23 07:05 simov

How can I check the mime type? I did on the command line a file --mime *md, and for all md files it shows text/plain. Could it be that Firefox on MacOS has its own idea on how it handles such a file .... maybe based on the file extension?

rovf avatar May 26 '23 08:05 rovf

@rovf Have you already checked your auto-open preferences on Firefox? Maybe that's where MarkEdit is configured to be triggered. Just guessing!

roberto-red avatar May 26 '23 09:05 roberto-red

Ah, it associates the action "MarkEdit" with files of extension .md

What value should I set this association? I have the choices:

  • Ask every time
  • Save the file
  • Use MarkEdit (default)
  • Use a different application

Since the first three choices are obviously wrong, I tried the last one. This opened a file browser, but I don't know which file (application) I should choose here. After all, MarkdownViewer is not an external application, but a browser extension.

rovf avatar May 26 '23 10:05 rovf

As far as I know that configuration is for unknown file types to Firefox, meaning files that it does not know how to render. By default markdown files should be rendered as plain text, meaning the browser knows how to render them even if it is a plain text only. Most likely MarkEdit has updated the internal mime type settings file that Firefox uses.

On Linux in particular that file can be located like this: Screenshot from 2023-05-26 13-42-23

But I don't know where a similar file can be found on MacOS and what are the contents of it.

simov avatar May 26 '23 10:05 simov

Unfortunately, the current Firefox ext. version 5.1 doesn't work (at least with file://) on current Firefox 116.0.2 on Manjaro Linux. It shows the Markdown source as plain text. I did follow all 3 methods from https://github.com/simov/markdown-viewer/blob/main/firefox.md, restarted Firefox after each, double-checked... "Markdown" is selected, file access granted...

Then I've installed https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-webext/ = https://github.com/Cimbali/markdown-viewer#support-for-local-files-on-linux. It works (at least with file://) with the exact Firefox settings.

Anyway, thank you. Hope this helps.

peter-lyons-kehl avatar Aug 17 '23 19:08 peter-lyons-kehl

https://github.com/simov/markdown-viewer/blob/main/firefox.md

azuledu avatar Jan 10 '24 15:01 azuledu