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

Rendering does not work on Firefox #213

Open
rovf opened this issue May 24, 2023 · 16 comments
Open

Rendering does not work on Firefox #213

rovf opened this issue May 24, 2023 · 16 comments
Labels

Comments

@rovf
Copy link

rovf commented May 24, 2023

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

@simov
Copy link
Owner

simov commented May 24, 2023

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.

@rovf
Copy link
Author

rovf commented May 24, 2023

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.

@simov
Copy link
Owner

simov commented May 24, 2023

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

@roberto-red
Copy link

roberto-red commented May 25, 2023

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!

@rovf
Copy link
Author

rovf commented May 25, 2023

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.

@roberto-red
Copy link

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

Screenshot 2023-05-25 at 16 29 22

@rovf
Copy link
Author

rovf commented May 26, 2023

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
Copy link
Author

rovf commented May 26, 2023

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

@simov
Copy link
Owner

simov commented May 26, 2023

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

@rovf
Copy link
Author

rovf commented May 26, 2023

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?

@roberto-red
Copy link

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

@rovf
Copy link
Author

rovf commented May 26, 2023

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.

@simov
Copy link
Owner

simov commented May 26, 2023

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.

@peter-kehl
Copy link

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.

@simov simov added the firefox label Sep 17, 2023
@azuledu
Copy link

azuledu commented Jan 10, 2024

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

@cweiske
Copy link

cweiske commented May 13, 2024

Related Firefox bug report: Bug 1319262: Mime type text/markdown is downloaded instead of displayed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants