noteblock -> grid
This commit is contained in:
parent
e56354c152
commit
2d05185a39
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* grid.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||
*
|
||||
* {% grid [color:color] [child:codeblock/tabs] title %}
|
||||
* body
|
||||
* {% endgrid %}
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
hexo.extend.tag.register('grid', function(args, content) {
|
||||
args = hexo.args.map(args, ['color', 'child'], ['title']);
|
||||
const color = args.color;
|
||||
const title = args.title;
|
||||
var el = '';
|
||||
const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
|
||||
if (!color && defaultColor) {
|
||||
color = defaultColor;
|
||||
}
|
||||
// header
|
||||
el += '<div class="tag-plugin note"';
|
||||
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
|
||||
el += '>';
|
||||
// title
|
||||
if (title && title.length > 0) {
|
||||
el += '<div class="title"><strong>' + title + '</strong></div>';
|
||||
}
|
||||
// content
|
||||
el += '<div class="body">';
|
||||
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
||||
el += '</div></div>';
|
||||
|
||||
return el;
|
||||
}, {ends: true});
|
|
@ -2,18 +2,17 @@
|
|||
* note.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||
*
|
||||
* note:
|
||||
* {% note [color:color] [title] content %}
|
||||
*
|
||||
* noteblock:
|
||||
* {% noteblock [color:color] [child:codeblock/tabs] title %}
|
||||
* markdown content
|
||||
* {% endnoteblock %}
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function outputNoteBlock(args, content) {
|
||||
hexo.extend.tag.register('note', function(args) {
|
||||
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
||||
if (args.content == undefined || args.content.length <= 0) {
|
||||
args.content = args.title;
|
||||
args.title = '';
|
||||
}
|
||||
const color = args.color;
|
||||
const title = args.title;
|
||||
var el = '';
|
||||
|
@ -31,22 +30,8 @@ function outputNoteBlock(args, content) {
|
|||
}
|
||||
// content
|
||||
el += '<div class="body">';
|
||||
el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
|
||||
el += hexo.render.renderSync({text: args.content, engine: 'markdown'}).split('\n').join('');
|
||||
el += '</div></div>';
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
hexo.extend.tag.register('note', function(args) {
|
||||
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
||||
if (args.content == undefined || args.content.length <= 0) {
|
||||
args.content = args.title;
|
||||
args.title = '';
|
||||
}
|
||||
return outputNoteBlock(args, args.content);
|
||||
});
|
||||
|
||||
hexo.extend.tag.register('noteblock', function(args, content) {
|
||||
args = hexo.args.map(args, ['color', 'child'], ['title']);
|
||||
return outputNoteBlock(args, content);
|
||||
}, {ends: true});
|
||||
|
|
|
@ -62,6 +62,9 @@ hexo.extend.tag.register('sites', function(args) {
|
|||
}
|
||||
if (groupId in sites) {
|
||||
let group = sites[groupId];
|
||||
if ((typeof group == 'object') && group.constructor == Array) {
|
||||
group = {items: group};
|
||||
}
|
||||
if (group.title || group.description) {
|
||||
el += groupHeader(group);
|
||||
}
|
|
@ -32,3 +32,6 @@
|
|||
line-height: 1
|
||||
font-weight: 700
|
||||
font-family: $ff-code
|
||||
h1,h2,h3,h4
|
||||
sup,sub
|
||||
font-size: .85rem
|
||||
|
|
Loading…
Reference in New Issue