Media type / text
text/markdown
Markdown source. The variant parameter names the flavour, since 'Markdown' alone does not identify a parser.
Served inline: Browsers have no renderer for this, so it downloads even without a Content-Disposition header. That makes it the quiet default for anything you do not want opened in place.
Browser behaviour
Downloads
Charset
charset required
Compression
Compress in transit
Send it like this
Content-Type: text/markdown; charset=utf-8Send `; charset=utf-8`. Without it the receiver falls back to its own default — for some text types that default is us-ascii, and any non-ASCII character then renders wrong.
Handling verdict
Browsers have no renderer for this, so it downloads even without a Content-Disposition header. That makes it the quiet default for anything you do not want opened in place.
Send `; charset=utf-8`. Without it the receiver falls back to its own default — for some text types that default is us-ascii, and any non-ASCII character then renders wrong.
The payload is text-like or otherwise repetitive, so gzip or Brotli removes real bytes. Enable it at the server or CDN.
Registered with IANA through a public review process, so the name is stable and every implementation can rely on it meaning the same thing.
Anatomy of the name
RFC 6838Top-level type
text
Text
Subtype
markdown
Registered in the standards tree.
Structured syntax
none
No suffix, so the payload format is defined entirely by the subtype itself.
Parameters
variant
Defined for this type in addition to any charset rule above.
What trips people up
1 note- Browsers render Markdown as plain text; the formatting happens wherever the file is opened next.
Response headers
Content-Type: text/markdown; charset=utf-8
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename="example.md"
Vary: Accept-Encodingnosniff stops the browser second-guessing the type you declared, which is what makes the rest of this reliable. Content-Disposition: attachment names the saved file and removes any doubt about rendering.
Server configuration
extension mappingnginx
types {
text/markdown md markdown;
}Apache
AddType text/markdown .md .markdown
AddCharset UTF-8 .md .markdownCaddy
@type path *.md *.markdown
header @type Content-Type "text/markdown; charset=utf-8"