Closed carns closed 2 years ago
Thanks for reporting @carns. There’s a lot of things to unpack here I’m afraid:
file://
URIs? (For example try a gitlab-hosted README.) Or do they render if you open them from the browser but opening from the command line doesn’t redirect to firefox / markdown-viewer?file://
URIs forbidden in these span builds?Unfortunately I am not that familiar with snap either, but Canonical has been transitioning a few packages to that system. From a user perspective two notable things are that packages auto update (rather than prompting you to update) and the packages operate in a file system sandbox so they cannot access all files and directories. There are possibly some other restrictions associated with the sandbox.
As for "does not work", from an end-user perspective, it behaves as if the extension is not present. Firefox prompts to save .md files with an external program.
I'm not sure about error messages in the firefox console; I will have to re-enable the snap version of firefox later and report back.
As for "does not work", from an end-user perspective, it behaves as if the extension is not present. Firefox prompts to save .md files with an external program.
I see. That’s kind of problematic indeed. The usual solutions are to update the list of mime-types in Linux, but that’s something a sandboxed Firefox might not have access to. Though it seems markdown appears in a default system file for me now, in /usr/share/mime/packages/freedesktop.org.xml
:
<mime-type type="text/markdown">
<comment>Markdown document</comment>
<comment xml:lang="af">Markdown-dokument</comment>
<comment xml:lang="ast">Documentu Markdown</comment>
<comment xml:lang="bg">Документ — Markdown</comment>
<comment xml:lang="ca">document Markdown</comment>
<comment xml:lang="cs">dokument Markdown</comment>
<comment xml:lang="da">Markdown-dokument</comment>
<comment xml:lang="de">Markdown-Dokument</comment>
<comment xml:lang="el">Έγγραφο Markdown</comment>
<comment xml:lang="en-GB">Markdown document</comment>
<comment xml:lang="es">documento Markdown</comment>
<comment xml:lang="eu">Markdown dokumentua</comment>
<comment xml:lang="fi">Markdown-asiakirja</comment>
<comment xml:lang="fr">document Markdown</comment>
<comment xml:lang="fur">document Markdown</comment>
<comment xml:lang="ga">cáipéis Markdown</comment>
<comment xml:lang="gl">documento de Markdown</comment>
<comment xml:lang="he">מסמך Markdown</comment>
<comment xml:lang="hr">Markdown dokument</comment>
<comment xml:lang="hu">Markdown dokumentum</comment>
<comment xml:lang="ia">Documento Markdown</comment>
<comment xml:lang="id">Dokumen markdown</comment>
<comment xml:lang="it">Documento Markdown</comment>
<comment xml:lang="ja">Markdown </comment>
<comment xml:lang="kk">Markdown құжаты</comment>
<comment xml:lang="ko">마크다운 문서</comment>
<comment xml:lang="lv">Markdown dokuments</comment>
<comment xml:lang="nl">Markdown document</comment>
<comment xml:lang="oc">document Markdown</comment>
<comment xml:lang="pl">Dokument Markdown</comment>
<comment xml:lang="pt">documento Markdown</comment>
<comment xml:lang="pt-BR">Documento Markdown</comment>
<comment xml:lang="ru">Документ Markdown</comment>
<comment xml:lang="sk">Dokument Markdown</comment>
<comment xml:lang="sl">Dokument Markdown</comment>
<comment xml:lang="sr">Маркдаун документ</comment>
<comment xml:lang="sv">Markdown-dokument</comment>
<comment xml:lang="tr">Markdown belgesi</comment>
<comment xml:lang="uk">документ Markdown</comment>
<comment xml:lang="zh-CN">Markdown 文档</comment>
<comment xml:lang="zh-TW">Markdown 文件</comment>
<sub-class-of type="text/plain"/>
<glob pattern="*.md"/>
<glob pattern="*.mkd"/>
<glob pattern="*.markdown"/>
<alias type="text/x-markdown"/>
</mime-type>
I can reproduce so far, with:
So out of the box, online markdown files like the ones I linked to still work. The proposed action for a local md file is indeed to save as attachment. The workaround currently in the doc of using ~/.mime.types
seems to fail for 2 reasons with snap packages:
~
into the home pathTherefore, the workaround is to place the helpers file in a directory accessible by firefox, e.g. where profiles are stored, and to pass the full path. So
about:profiles
page. For example, my about:profiles
says my profile is located at /home/me/snap/firefox/common/.mozilla/firefox/ybmmt15r.default
, so I created a file /home/me/snap/firefox/common/mime.types
type=text/plain exts=md,mkd,mkdn,mdwn,mdown,markdown, desc="Markdown document"
about:config
and search for helpers.private_mime_types_file
/home/me/snap/firefox/common/mime.types
(note that it’s the fully expanded path, not ~/snap/firefox/...
)Thank you for tracking that down @Cimbali !
No worries @carns. This would all be much easier if webextensions could simply define the mime types they handle, but there’s still no ETA on that.
Worked for me, except I had to make the filename .mime.types
(with a leading period).
Related: I noticed that https://github.com/asciidoctor/asciidoctor-browser-extension somehow works on plain text Asciidoc files without this or other hacks. :shrug:
Thanks, I’ll look into how they do it
I don't know if this is something that could be fixed in the extension or if it is a fundamental limitation of the snap package system. It's mainly relevant for Ubuntu 21.10 users since Ubuntu elected to change the default Firefox package from apt to snap.
For anyone else who looks at this issue, one workaround is to simply disable the snap package and install the apt one:
There are some side effects (in particular: losing bookmarks etc. that you may have created while using the snap package, and of course the issue of whether you want to go against the grain with Ubuntu policy), but this, access to /tmp, and some other extensions will work again.