diff options
author | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2015-05-05 02:36:56 (GMT) |
---|---|---|
committer | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2015-05-05 02:36:56 (GMT) |
commit | 56216ac16079a67f650b34ad94fd738f16da68bf (patch) | |
tree | 6d90729d366f911e70713e0ae8128f523efad99b /js | |
parent | 101a7e74fbccdccb9387d2d0803b7c9a4fe38bfc (diff) | |
download | lz4-56216ac16079a67f650b34ad94fd738f16da68bf.zip lz4-56216ac16079a67f650b34ad94fd738f16da68bf.tar.gz lz4-56216ac16079a67f650b34ad94fd738f16da68bf.tar.bz2 |
Add 'include' function to strapdown
Usage:
Set 'src' attribute to <xmp> tag to include external Markdown file.
Example :
<xmp theme="sandstone" style="display:none;" src="lz4_Block_format.md"></xmp>
Diffstat (limited to 'js')
-rw-r--r-- | js/strapdown-hook.js | 24 |
1 files changed, 24 insertions, 0 deletions
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();
+ }
+ }
+});
|