commonmark-spec
commonmark-spec copied to clipboard
Add appendix about text/markdown media type and file extension
in particular to indicate the registered CommonMark variant.
My addition also included below for convenience:
Appendix: Media Type and file extension
MarkDown is primarily intended as a "write" format for generating HTML,
which could then be served over HTTP with the
Content-Type header
text/html or similar. However there may be cases where MarkDown
is served as-is, for instance as part of HTTP-based editing of
the MarkDown source.
Media Type
HTTP clients and servers can indicate that a resource is MarkDown of the CommonMark variant, encoded in character set UTF-8, by using the HTTP header:
Content-Type: text/markdown; charset=UTF-8; variant=CommonMark
Background: RFC7763 registers
text/markdown
in the IANA media type registry.
RFC7764 registers
CommonMark as a variant of MarkDown.
File Extension
To indicate a local file is a MarkDown file compliant with CommonMark it
is recommended to use the file extension .commonmark.md although
.commonmark.markdown may also be used.
Background: RFC7764 section 2.1
recommends using .markdown or .md with the variant identifier
as a prefix to the file extension. As file extensions tend to be all
lowercase and some file systems preserve file case,
the variant is expressed as commonmark - note however that
file extensions should be compared case-insensitively when reading.
Well, the best use case for text/markdown would be single-part emails. Unfortunately, some MUAs cannot handle mails correctly that do not use the default text/plain.