X
Tap here to go to the mobile version of the site.

Support Forum

Open markdown file with md extension in Firefox

Posted

I’m clicking on a link that links to a markdown file ending in the extension .md. As I know that this is just a plain text file, I would like to open it in a new tab as plain text. However, Firefox opens a download prompt. How can I teach Firefox to display the file as text?

I’m clicking on a link that links to a markdown file ending in the extension .md. As I know that this is just a plain text file, I would like to open it in a new tab as plain text. However, Firefox opens a download prompt. How can I teach Firefox to display the file as text?

Chosen solution

If this is a text file then prefix the link with the view-source: protocol to open the file as a text file in a tab. You can usually copy the link to the clipboard via the right-click context menu (Copy Link Location).

  • view-source:https://....
Read this answer in context 2
Quote

Additional System Details

Application

  • User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

More Information

FredMcD
  • Top 10 Contributor
4398 solutions 61734 answers

Helpful Reply

Windows Firefox can display text files. Save a .md file to your hard drive. Open your file explorer and right-click the file. Set its properties to treat the file as a text file. (Windows)

Windows Firefox can display text files. Save a '''.md''' file to your hard drive. Open your file explorer and right-click the file. Set its properties to treat the file as a text file. (Windows)
Was this helpful to you? 1
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17879 solutions 161769 answers

Chosen Solution

If this is a text file then prefix the link with the view-source: protocol to open the file as a text file in a tab. You can usually copy the link to the clipboard via the right-click context menu (Copy Link Location).

  • view-source:https://....
If this is a text file then prefix the link with the view-source: protocol to open the file as a text file in a tab. You can usually copy the link to the clipboard via the right-click context menu (Copy Link Location). *view-source:https://....
Was this helpful to you? 2
Quote
jscher2000
  • Top 10 Contributor
8963 solutions 73452 answers

Where is the .md file coming from?

If it's from a site like Github that is conversant with the extension, the "Raw" link will serve the file as plain text (Content-Type: text/plain):

HTML: https://github.com/jscher2000/google-uk-search/blob/master/README.md Raw: https://raw.githubusercontent.com/jscher2000/google-uk-search/master/README.md

Some other sites may indicate the correct Content-Type but push the file as a forced download (Content-Disposition: attachment).

Yet others may send a non-matching Content-Type to bypass viewing in the browser.

If you'll allow a little self-promotion, I have an add-on for that. You can use it to associate text/plain with the .md file extension and to override forced downloading. (Those are separate features.)

https://addons.mozilla.org/firefox/addon/content-type-fixer/

After installation, it is dormant. Click the Zzzz button to wake it up and trigger the download. Then use the button's drop-down menu to view the log and you can associate the correct Content-Type with .md files.

Now... many sites also serve HTML pages with the .md extension, so you probably only want to turn on this new association when you run across a problem. You can turn off the extension completely the rest of the time, or use the Enable/Disable types list to manage .md.

Where is the .md file coming from? If it's from a site like Github that is conversant with the extension, the "Raw" link will serve the file as plain text (Content-Type: text/plain): HTML: https://github.com/jscher2000/google-uk-search/blob/master/README.md Raw: https://raw.githubusercontent.com/jscher2000/google-uk-search/master/README.md Some other sites may indicate the correct Content-Type but push the file as a forced download (Content-Disposition: attachment). Yet others may send a non-matching Content-Type to bypass viewing in the browser. If you'll allow a little self-promotion, I have an add-on for that. You can use it to associate '''text/plain''' with the .md file extension and to override forced downloading. (Those are separate features.) https://addons.mozilla.org/firefox/addon/content-type-fixer/ After installation, it is dormant. Click the Zzzz button to wake it up and trigger the download. Then use the button's drop-down menu to view the log and you can associate the correct Content-Type with .md files. Now... many sites also serve HTML pages with the .md extension, so you probably only want to turn on this new association when you run across a problem. You can turn off the extension completely the rest of the time, or use the Enable/Disable types list to manage .md.

Modified by jscher2000

Was this helpful to you? 1
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.