Last active
December 30, 2015 11:39
-
-
Save wzpan/7823621 to your computer and use it in GitHub Desktop.
Hexo tag plugins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var render = hexo.render; | |
/** | |
* alert tag | |
* | |
* Syntax: | |
* {% alert caption [style] %} | |
* Alert string | |
* {% endalert %} | |
*/ | |
module.exports = function(args, content){ | |
var caption = args[0]; | |
var style; | |
if (args.length > 1) | |
style = args[1]; | |
else | |
style = "success"; | |
var text = '<div class="alert alert-' + style + '"><strong>' + caption + '</strong>: ' + content + '</div>'; | |
return render.renderSync({text: text, engine: 'markdown'}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tag = hexo.extend.tag; | |
var blockquote = require('./blockquote'); | |
tag.register('quote', blockquote, true); | |
tag.register('blockquote', blockquote, true); | |
var code = require('./code'); | |
tag.register('code', code, true); | |
tag.register('codeblock', code, true); | |
tag.register('gist', require('./gist')); | |
tag.register('iframe', require('./iframe')); | |
var img = require('./img'); | |
tag.register('img', img); | |
tag.register('image', img); | |
var include_code = require('./include_code'); | |
tag.register('include_code', include_code); | |
tag.register('include-code', include_code); | |
tag.register('jsfiddle', require('./jsfiddle')); | |
var link = require('./link'); | |
tag.register('a', link); | |
tag.register('link', link); | |
tag.register('anchor', link); | |
tag.register('pullquote', require('./pullquote'), true); | |
tag.register('rawblock', require('./raw'), true); | |
tag.register('vimeo', require('./vimeo')); | |
tag.register('youtube', require('./youtube')); | |
tag.register('label', require('./label')); | |
var mnote = require('./mnote'); | |
tag.register('mnote', mnote, true); | |
var mimg = require('./mimg'); | |
tag.register('mimg', mimg); | |
var wthought = require('./wthought'); | |
tag.register('wthought', wthought, true); | |
var alert = require('./alert'); | |
tag.register('alert', alert, true); | |
tag.register('slides', require('./slides')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* label tag | |
* | |
* Syntax: | |
* {% label text [style] %} | |
*/ | |
module.exports = function(args, content){ | |
var text = args[0]; | |
var style; | |
if (args.length > 1) | |
style = args[1]; | |
else | |
style = "success"; | |
return '<span class="label label-' + style +'">' + text + '</span>' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* margin image tag | |
* | |
* Syntax: | |
* {% mimg index url text %} | |
*/ | |
module.exports = function(args, content){ | |
var url = args[0]; | |
var text = args[1]; | |
var index = args[2]; | |
return "<span class='block margin-div-outer'><span class='block margin-div-inner'><span class='block margin-note'><img src=" + url + " alt='" + text + "'></img><b>图 " + index + "</b> " + text + "</span></span></span>"; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var render = hexo.render; | |
/** | |
* margin note tag | |
* | |
* Syntax: | |
* {% mnote index %} | |
* Margin note string | |
* {% endmnote %} | |
*/ | |
module.exports = function(args, content){ | |
if (args){ | |
var index = args[0]; | |
mnote = '<span class="margin-note-marker"><sup>' + index + '</sup></span> <span class="block margin-div-outer"><span class="block margin-div-inner"><span class="block margin-note"><span class="margin-note-marker">' + index + '</span>' + content + '</span></span></span>'; | |
} else { | |
mnote = '<span class="block margin-div-outer"><span class="block margin-div-inner"><span class="block margin-note">' + content + '</span></span></span>'; | |
} | |
var text = render.renderSync({text: mnote, engine: 'markdown'}); | |
text = text.substring(3, text.length-5); | |
return text; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var render = hexo.render; | |
/** | |
* wiki thoughts tag | |
* | |
* Syntax: | |
* {% wthought [author] %} | |
* Text | |
* {% endwthought %} | |
*/ | |
module.exports = function(args, content){ | |
var author = 'Anonymous'; | |
if (args){ | |
author = args.join(' '); | |
} | |
var text = '<div class="left"><div class="bubble-green"><div class="bubble-avatar">' + author + '</div>' + content + '</div></div>'; | |
return render.renderSync({text: text, engine: 'markdown'}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment