What is the mime type for markdown?

2020-02-02 06:20发布

问题:

Anyone knows if a mime type exists for markdown? I guess it is plain-text but is there a more specific one?

回答1:

There is no official standard type, but text/markdown seems to be the most common de facto type. Most browsers and other reasonably sophisticated clients will likely see the text/ part and default to text/plain anyway, so there's not much difference.

One caveat, though: all types under the text/ hiearchy default to ISO-8859-1 for their character type in the relevant RFC standards. Most of the world has since moved on to UTF-8. So unless you're positive you won't be using any funny characters (or live in an old Windows world) you might want to specify it as follows:

text/markdown; charset=UTF-8


回答2:

tl;dr: text/markdown since March 2016

In March 2016, text/markdown was registered as RFC7763 at IETF.

Previously, it should have been text/x-markdown. The text below describes the situation before March 2016, when RFC7763 was still a draft.


There is no official recommendation on Gruber’s definition, but the topic was discussed quite heavily on the official mailing-list, and reached the choice of text/x-markdown.

This conclusion was challenged later, has been confirmed and can be, IMO, considered consensus.

This is the only logical conclusion in the lack of an official mime type: text/ will provide proper default almost everywhere, x- because we're not using an official type, markdown and not gruber. or whatever because the type is now so common.

There are still unknowns regarding the different “flavors” of Markdown, though. I guess someone should register an official type, which is supposedly easy, but I doubt anyone dares do it beyond John Gruber, as he very recently proved his attachment to Markdown.

There is a draft on the IETF for text/markdown, but the contents do not seem to describe Markdown at all, so I wouldn't use it until it gets more complete.



回答3:

Looks like text/markdown is going to be the standard.

  • http://www.iana.org/go/draft-ietf-appsawg-text-markdown

  • https://www.iana.org/assignments/media-types/media-types.xhtml

    Search for markdown.



回答4:

Found this thread from 2008 : http://www.mail-archive.com/markdown-discuss@six.pairlist.net/msg00973.html

Seems like the mime type text/vnd.daringfireball.markdown should be registered by the author of Markdown, until then the Markdown mime type can be specified as text/x-markdown.