From 56216ac16079a67f650b34ad94fd738f16da68bf Mon Sep 17 00:00:00 2001 From: Takayuki MATSUOKA Date: Tue, 5 May 2015 11:36:56 +0900 Subject: Add 'include' function to strapdown Usage: Set 'src' attribute to tag to include external Markdown file. Example : <xmp theme="sandstone" style="display:none;" src="lz4_Block_format.md"> --- js/strapdown-hook.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 js/strapdown-hook.js diff --git a/js/strapdown-hook.js b/js/strapdown-hook.js new file mode 100644 index 0000000..672e5b6 --- /dev/null +++ b/js/strapdown-hook.js @@ -0,0 +1,24 @@ +$(document).ready(function() { + var strapdown = function() { + var script = document.createElement('script'); + script.src = "strapdown/v/0.2/strapdown.js"; + document.body.appendChild(script); + }; + + var xmpEl = $("xmp:first"); + if(xmpEl) { + var xmpSrc = xmpEl.attr("src"); + if(xmpSrc) { + $.ajax({ + url : xmpSrc, + dataType : "text", + success : function(data) { + xmpEl.text(data); + strapdown(); + } + }); + } else { + strapdown(); + } + } +}); -- cgit v0.12