From ce0facf7b24bd43e8ca6e77f69fd2c651b840341 Mon Sep 17 00:00:00 2001 From: Emile 'iMil' Heitor Date: Tue, 23 Jul 2013 17:31:30 +0200 Subject: [PATCH 1/2] added custom charset support for external markdown file --- plugin/markdown/markdown.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 473666b8..9681cf1d 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) { From 3ca598473b710d98e82d094f19d16d428cf2066e Mon Sep 17 00:00:00 2001 From: Emile 'iMil' Heitor Date: Tue, 23 Jul 2013 17:34:23 +0200 Subject: [PATCH 2/2] updated markdown example with data-charset --- plugin/markdown/example.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/markdown/example.html b/plugin/markdown/example.html index 1253cbac..90ff1346 100644 --- a/plugin/markdown/example.html +++ b/plugin/markdown/example.html @@ -16,8 +16,8 @@
- -
+ +