[PATCH] Add markdown to mime.types

Andrea Pappacoda andrea at pappacoda.it
Tue Aug 27 12:08:31 UTC 2024


Hi all!

This is in reply to a relatively old patch adding "text/markdown" to 
mime.types.

On Tue, 14 Sep 2021 20:08:15 +0300, Maxim Dounin wrote:
>Hello!
>
>On Thu, Sep 09, 2021 at 10:35:32PM -0400, Abe Massry wrote:
>
>> # HG changeset patch
>> # User Abe Massry <a at abemassry.com>
>> # Date 1631238770 14400
>> #      Thu Sep 09 21:52:50 2021 -0400
>> # Branch update-mime-types
>> # Node ID 95a61e228bc19f6b9917671dfd2e6ff52e3e0294
>> # Parent  a525013b82967148e6e4b7e0eadd23e288001816
>> Add markdown to mime.types
>>
>> In the chromimum browser a warning is displayed if a markdown
>> mime type does not appear in the list of mime types on the server.
>> The browser attempts to download the file but gives a warning
>> saying that this type of file is usually displayed in the
>> browser.
>>
>> Files with a mime type of markdown and a file extension of `.md`
>> should be displayed as plain text in the browser and this
>> change adds that to the default mime types that will ship with
>> nginx.
>>
>> diff -r a525013b8296 -r 95a61e228bc1 conf/mime.types
>> --- a/conf/mime.types	Tue Sep 07 18:21:03 2021 +0300
>> +++ b/conf/mime.types	Thu Sep 09 21:52:50 2021 -0400
>> @@ -9,6 +9,7 @@
>>      application/atom+xml                             atom;
>>      application/rss+xml                              rss;
>>
>> +    text/markdown                                    md;
>>      text/mathml                                      mml;
>>      text/plain                                       txt;
>>      text/vnd.sun.j2me.app-descriptor                 jad;
>>
>
>A side note: the "text/markdown" specification says that the charset 
>attribute is required, and this is not something nginx provides unless 
>the charset module is explicitly used.
>
>(see RFC 7763 and/or 
>https://www.iana.org/assignments/media-types/text/markdown)

While it is true that the IANA assignment says that the charset 
attribute is required, it does so because of RFC 6838. This RFC, in 
fact, specifies that *all* text/* MIME types "MUST" specify the charset, 
unless that information is already present in the file format itself, 
like required by XML.

Hence, in a way, (free)nginx is already going against RFC 6838 whenever 
sending any text/* MIME type, but it cannot really do in any other way- 
only the user can know the actual charset of a given file.

So in my opinion the markdown MIME type should be added, and it is up to 
the user to comply with RFC 6838. Maybe it'd make sense to mention that 
in the mime.types file.

What do you think?

Please CC me as I'm not subscribed to this list. Thanks!

Bye :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: not available
URL: <http://freenginx.org/pipermail/nginx-devel/attachments/20240827/7c83163f/attachment.sig>


More information about the nginx-devel mailing list