aboutsummaryrefslogtreecommitdiff
path: root/plugin/markdown
diff options
context:
space:
mode:
authorEmile 'iMil' Heitor <imil@NetBSD.org>2013-07-23 17:31:30 +0200
committerEmile 'iMil' Heitor <imil@NetBSD.org>2013-07-23 17:31:30 +0200
commitce0facf7b24bd43e8ca6e77f69fd2c651b840341 (patch)
treee75c716964f1650dd2f0fc353bc8189b466d3068 /plugin/markdown
parent7d19b4f7ce2ab3fd7880d0f60b1c147d44808f0c (diff)
downloadfreenode-live-2017-presentation-ce0facf7b24bd43e8ca6e77f69fd2c651b840341.tar
freenode-live-2017-presentation-ce0facf7b24bd43e8ca6e77f69fd2c651b840341.tar.gz
added custom charset support for external markdown file
Diffstat (limited to 'plugin/markdown')
-rwxr-xr-xplugin/markdown/markdown.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 473666b..9681cf1 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -128,6 +128,12 @@
var xhr = new XMLHttpRequest(),
url = section.getAttribute('data-markdown');
+ datacharset = section.getAttribute('data-charset');
+ // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
+ if (datacharset != null && datacharset != '') {
+ xhr.overrideMimeType('text/html; charset=' + datacharset);
+ }
+
xhr.onreadystatechange = function () {
if( xhr.readyState === 4 ) {
if (xhr.status >= 200 && xhr.status < 300) {