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

How to open local markdown file in firefox59.0.1 #54

Closed
HeJiaJunPan opened this issue Mar 28, 2018 · 12 comments
Closed

How to open local markdown file in firefox59.0.1 #54

HeJiaJunPan opened this issue Mar 28, 2018 · 12 comments
Labels

Comments

@HeJiaJunPan
Copy link

When I disable the extension, the browser can open the local file. However, after the extension is enabled, the file content is no longer displayed, let alone render the markdown document.

How do i set it up on firefox?Is the installation document more detailed?

@HeJiaJunPan
Copy link
Author

I am a Chinese user and cannot use youtube.

The video content is also not very user-friendly.

@simov simov added the question label Mar 28, 2018
@simov
Copy link
Owner

simov commented Mar 28, 2018

Firefox does not support rendering of markdown documents, that's why file rendering is not supported in Markdown Viewer for Firefox.

@HeJiaJunPan
Copy link
Author

@simov
What is the method of compromise?

Markdown Viewer Webext works fine on firefox

@simov
Copy link
Owner

simov commented Mar 28, 2018

No, it does not work for file URLs.

From the first comment:

Note that the author notes that the extension only works "if the content is plain text". That means your browser needs to be rendering the file in a tab already, just without rendering the markdown elements. If it's downloading it instead, the suggestion from 7cac17 below, to add a MIME type for markdown files, worked for me (I'm also on Ubuntu).

Related to this Cimbali/markdown-viewer#2 (comment)

@njnygaard
Copy link

njnygaard commented Apr 25, 2018

This plugin works for me in FF 59.0.2: https://github.com/painyeph/GitLabMarkdownViewer

I would venture a guess that it has to do with:

  "content_scripts": [
    {
      "matches": ["file:///*.md", "file:///*.markdown"],
      "js": ["js/markdown-it.min.js",
             "js/highlight.pack.min.js",
             "js/katex.min.js",
             "js/texmath.js",
             "js/main.js"
             ]
    }
],

I would submit a PR, but I don't really know how to browser extensions. Do you have recommendations on tutorials? I'd have to try chrome and ff.

simov/markdown-viewer is superior because of the themes, so I would like to contribute here if possible.

@simov
Copy link
Owner

simov commented Apr 25, 2018

@njnygaard the extension you are linking to doesn't work with file URLs, for example file:///some/path/file.md. Check out the screencast https://youtu.be/c7Lb_Y092ok where I'm showing a simple file server running on localhost that you can use to access your markdown files.

@njnygaard
Copy link

That's a great idea with the local file server, that will solve my cross platform problem too.

On my system, opening file:/// with the linked extension seems to work fine...

image

@simov
Copy link
Owner

simov commented Apr 25, 2018

That's interesting, it doesn't work on my end on Linux.

@njnygaard
Copy link

Okay good to know. Yeah I would be frustrated if I tried it and it failed when I switched to my personal computer.

I'm linking the gist from your video in case anyone else comes across this: https://gist.github.com/simov/4e4bb0a1ecbb45b92e23608388e60909

That file server is exactly what I need, I didn't know there was an npm package to view files. Perfect solution for me. Thanks!

@gotjen
Copy link

gotjen commented Dec 12, 2020

@njnygaard, would you explain to the lay person how to use this code to start a webserver? How do I set up that js to run passively, not have to launch it every time?

// server.js
var express = require('express')
var serveIndex = require('serve-index')
var serveStatic = require('serve-static')

var app = express()

app.use(serveStatic('/home/s'))
app.use('/', serveIndex('/home/s', {'icons': true, view: 'details'}))

app.listen(8001)

@simov
Copy link
Owner

simov commented Dec 12, 2020

It depends on your operating system. On Linux I'm using systemd, quick search on Google shows that the equivalent of that on Mac OS is launchctl.

@simov simov removed the question label Dec 11, 2022
@simov
Copy link
Owner

simov commented Mar 18, 2023

I have created a separate documentation file regarding issues and their workarounds in Firefox including information about how can you render local file:/// URLs on Linux.

Let me know if you find anything missing, but for now I am closing this issue as it contains a lot of obsolete and incorrect statements about certain issues.

@simov simov closed this as completed Mar 18, 2023
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

4 participants