Transition to Jetpack SDK
Following #20 and #46, + the fact Mozilla is progressively deprecating XUL extensions, it becomes urgent to transition to another solution.
The two solutions are the Jetpack SDK and WebExtensions.
WebExtensions don't allow mime-type registering (yet?) so they're not an option for now.
As always, bhollis/jsonview is a good source of inspiration since it does the same thing as Markdown Viewer but for JSON :)
Important things to check along the development:
- [x] Linux support
- [ ] Windows support
- [x] UTF-8 support
- [ ] Electrolysis support
- [ ] Basically no behavioral regression
WIP on branch no-restart
Any new information on that? Since SDK will also be deprecated at the end of this year WebExtensions are the only way to go forward.
As far as I'm aware, and according to all the tests I've done, there's no way to make Markdown Viewer work with either Jetpack or WebExtensions.
Markdown Viewer needs to register the ".md" extension to Firefox (see this code) but it doesn't seem to be possible with either of the APIs, and I doubt it'll ever be possible in the future, given the direction taken by Mozilla to standardize extensions between browsers. The idea is good but not applicable since Gecko and Chromium platforms are fundamentally different.
Enjoy Markdown Viewer if it still works for you, or else consider it dead :(
What if you just check the URL if it ends on .md ?
It's not enough, it breaks on Linux because Firefox will download the file instead of displaying it.
With some persistence... I am happy to report that I was able to solve this issue. I was able to trick Firefox by modifying a local MIME type in Linux:
https://wiki.archlinux.org/index.php/default_applications#New_MIME_types
Here is what mine looks like currently with it working:
<?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>
@braderhart This might be a local workaround not a real solution how this can be rewritten as a webextension.
@Croydon I agree we need a better solution from Mozilla with WebExtensions for sure, but to finally get a fix—even if isn't the "proper" approach—it still solves a long-standing bug quite well for the time-being, and doesn't really seem to cause any issues.
You may even be able to create a proper fix yourself using the info provided here:
https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
If the only issue is reading the download stream as indicated by the code linked to in a previous comment, you should be able to do that since webRequest.onResponseData landed.
https://bugzilla.mozilla.org/show_bug.cgi?id=1255894
Sorry, it hasn't landed yet, but is close.
Landed.