Skip to content

Commit bfcafd3

Browse files
hatzopoulosXhmikosR
authored andcommitted
Serve .md and .markdown files as text/markdown.
Per RFC 7763 - https://tools.ietf.org/html/rfc7763 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Thanks @mathiasbynens! Closes #94
1 parent 9965d0f commit bfcafd3

11 files changed

+35
-4
lines changed

src/internet_explorer/x-ua-compatible.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# the `X-UA-Compatible` response header should be send only for
2424
# HTML documents and not for the other resources.
2525

26-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
26+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
2727
Header unset X-UA-Compatible
2828
</FilesMatch>
2929

src/media_types/character_encodings.conf

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ AddDefaultCharset utf-8
2525
.json \
2626
.jsonld \
2727
.manifest \
28+
.markdown \
29+
.md \
2830
.rdf \
2931
.rss \
3032
.topojson \

src/media_types/media_types.conf

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
AddType application/x-chrome-extension crx
7979
AddType application/x-opera-extension oex
8080
AddType application/x-xpinstall xpi
81+
AddType text/markdown markdown md
8182
AddType text/vcard vcard vcf
8283
AddType text/vnd.rim.location.xloc xloc
8384
AddType text/vtt vtt

src/security/content-security-policy.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# the `Content-Security-Policy` response header should be send
2828
# only for HTML documents and not for the other resources.
2929

30-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
30+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
3131
Header unset Content-Security-Policy
3232
</FilesMatch>
3333

src/security/x-frame-option.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# the `X-Frame-Options` response header should be send only for
4141
# HTML documents and not for the other resources.
4242

43-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
43+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
4444
Header unset X-Frame-Options
4545
</FilesMatch>
4646

src/security/x-xss-protection.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# the `X-XSS-Protection` response header should be send only for
4444
# HTML documents and not for the other resources.
4545

46-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
46+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
4747
Header unset X-XSS-Protection
4848
</FilesMatch>
4949

src/web_performance/compression.conf

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"text/html" \
5353
"text/javascript" \
5454
"text/plain" \
55+
"text/markdown" \
5556
"text/vcard" \
5657
"text/vnd.rim.location.xloc" \
5758
"text/vtt" \

src/web_performance/expires_headers.conf

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
ExpiresByType text/cache-manifest "access plus 0 seconds"
5959

6060

61+
# Markdown
62+
63+
ExpiresByType text/markdown "access plus 1 month"
64+
65+
6166
# Media files
6267

6368
ExpiresByType audio/ogg "access plus 1 month"

test/fixtures/test.markdown

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# test
2+
test test test test test
3+
4+
## test test
5+
test test test test test

test/fixtures/test.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# test
2+
test test test test test
3+
4+
## test test
5+
test test test test test

test/tests.js

+12
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,18 @@ exports = module.exports = {
296296
}
297297
},
298298

299+
'test.markdown': {
300+
responseHeaders: {
301+
'content-type': 'text/markdown; charset=utf-8'
302+
}
303+
},
304+
305+
'test.md': {
306+
responseHeaders: {
307+
'content-type': 'text/markdown; charset=utf-8'
308+
}
309+
},
310+
299311
'test.mp4': {
300312
responseHeaders: {
301313
'content-encoding': null,

0 commit comments

Comments
 (0)