Skip to content

Not loading md files in firefox on Ubuntu Linux #2

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

Closed
TWT-GSCHW opened this issue Aug 11, 2017 · 18 comments
Closed

Not loading md files in firefox on Ubuntu Linux #2

TWT-GSCHW opened this issue Aug 11, 2017 · 18 comments

Comments

@TWT-GSCHW
Copy link

Hi, I installed the markdown-viewer plugin for Firefox from here. But if I try to open a markdown file (e. g. file:///home/me/test.md) from my disk Firefox asks me if I want to save the file. I have found no way to view the file instead of downloading it. My Firefox version is 52.2.0 (64-bit) ESR.
Greetings

@KeithLRobertson
Copy link
Collaborator

Hmm. I'm sorry you're experiencing trouble! Local file loading is of course my primary test case. But I'm on 55.0.1. I've also used Developer Edition 55 and 56. I'll try to set up a VM and test with v52 on Linux, but my guess is that support for Web Extensions isn't fully baked into the older FF version. Can you try a more recent version? (I know, it won't support Java though.)

@TWT-GSCHW
Copy link
Author

I just went to 52.3.0 but that does not solve the problem. But it should be theoretically possible since I had this plugin on another machine, which worked fine with the same version of Firefox. Sadly that plugin is not installable anymore now but it still was 2-3 weeks ago. (It seems they changed the Firefox compatibility for that plugin to a version prior to mine, even though it worked fine...)

@KeithLRobertson
Copy link
Collaborator

Not necessarily. Thiht's plugin uses Firefox's old and deprecated plugin technology. Mine uses the new Web Extensions approach. Under the hood they both use the same markdown-to-html library, but how Firefox interfaces with it is entirely different.

@KeithLRobertson
Copy link
Collaborator

I tried an Ubuntu VM, but it came with FF 16, and I wasn't able to get it to upgrade properly. Will try again later with more recent Ubuntu.

BTW, regarding the title of this issue. This plugin doesn't trigger based on mime time. It installs itself with web extensions to trigger on any page load, and then it filters based on the extension of the final URL path segment.

@KeithLRobertson
Copy link
Collaborator

I was able to create an Ubuntu 16.04 VM which had FF 54.0, and I did see the same problem you experienced! It wasn't a problem with the WebExtension, but with how Firefox handles the unknown file type. I followed these instructions on superuser (with update-mime-database) to give markdown extensions a mime type, and Firefox would then load the local .md file, allowing markdown-viewer-webext to style it. Let me know if it works for you as well.

BTW, these other instructions on the same thread (modifying mimeTypes.rdf) did not work for me and were unnecessary.

@TWT-GSCHW
Copy link
Author

Works like a charm. Thank you very much. So it was a Firefox issue under Linux, not one from the plugin.

@mMerlin
Copy link

mMerlin commented Oct 5, 2017

@KeithLRobertson creating the ~/.local/share/mime/packages/text-markdown.xml file and running update-mime-database per the linked instructions worked for me on Fedora 24 with Firefox 54.0 as well.

@KeithLRobertson KeithLRobertson changed the title Firefox mime-type bug Not loading md files in firefox on Ubuntu Linux Oct 18, 2017
@dmrzzz
Copy link

dmrzzz commented Jan 3, 2018

Any chance of linking to this workaround directly from the add-on description shown in about:addons? This was exactly what I needed to get my file URLs working, but as a new user it took me a while to find it.

phansch added a commit to phansch/dotfiles that referenced this issue Feb 13, 2018
@globalcitizen
Copy link

Annoying. Find a way to automate this or let new users know up front.

@pbielefeldt
Copy link

Unfortunately, updating the MIME database does not work as expected for me on CentOS (7.4) with Firefox 52.7.2.

@vrubiolo
Copy link

Just wanted to mention that the instructions above allowed me to work around the problem using Firefox 63.0 on Ubuntu 18.04.1 using v.1.4.0 of the extension.

I think it would be a useful addition to the master doc/extension homepage. I was using the extension previously and did not encounter that problem.

markdown-viewer is my primary Markdown renderer so I am glad to see it is working again. Thanks for the useful extension!

@fractalf
Copy link

fractalf commented Jan 11, 2019

The workaround with writing a mime type file and updating db is not working for me..
Linux Mint 19 (based on Ubuntu 18.04) and Firefox Developer ed. 65.0b10 (64-bit)

All I see is the source mardown

@cx405
Copy link

cx405 commented Aug 4, 2019

Nixos 19.03 here, Linux kernel 5.1.18, Firefox 68.0esr (64-bit).

Fixed with these instructions on superuser, which were linked by KeithLRobertson.

I will copypaste them here, so they dont disappear:

$ touch ~/.local/share/mime/packages/text-markdown.xml
$ xdg-open ~/.local/share/mime/packages/text-markdown.xml

paste:

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/plain">
    <glob pattern="*.md"/>
    <glob pattern="*.mkd"/>
    <glob pattern="*.markdown"/>
  </mime-type>
</mime-info>

Save & quit.
$ update-mime-database ~/.local/share/mime

@tinyweasel
Copy link

tinyweasel commented Aug 27, 2019

Can't get this working with Ubuntu 18.04 and Firefox 68.0.2 (64-bit).

Edit: Got it working by allowing all origins in the addon settings, and toggling the reader view in the right side of the address bar.

@aw-bib
Copy link

aw-bib commented Jun 24, 2020

This is quite an old issue and granted that the above works in so far as it indeed triggers the rendering of markdown.

But is there a chance that FF would render the proper mime type as well? Just asking as adding the mime type suggested is actually demoting all markdown files from text/markdown and text/x-markdown (as defined in /usr/share/mime/text/markdown.xml) to text/plain. The most visual thing being that they loose their icons.

@mMerlin
Copy link

mMerlin commented Jun 24, 2020

I have not attempted this without the markdown override for quite awhile. The original issue was FF would not even try to render the markdown. When it saw the mime type, it just oferred to download the file. The plugin did not get a chance at the content.

@aw-bib
Copy link

aw-bib commented Jun 25, 2020

When it saw the mime type, it just oferred to download the file. The plugin did not get a chance at the content.

ic. :S I thought there might be a way like the hooks of a plugin but I have no idea about the inner workings of ff at all. Just use the plugin for preview all the time and sometimes it would be very convenient to spot the *.md files immediately in a folder full of other text files.

@mh182
Copy link

mh182 commented Sep 16, 2020

Since the upgrade to Firefox 80.0.1 on Linux (Debian Sid unstable) the fix described in #2 (comment) to associate local files with extension md to text/plain does not work.

Instead I had to add the mapping in ~/.mime.types and restart Firefox:

$ echo "text/plain                                   md markdown" >> ~/.mime.types

See also https://bugzilla.mozilla.org/show_bug.cgi?id=1319262

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

No branches or pull requests