child tag

This commit is contained in:
xaoxuu 2021-07-14 00:03:28 +08:00
parent 8bb5c09d71
commit f37326822c
4 changed files with 15 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* folding.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
* 格式与官方标签插件一致使用空格分隔中括号内的是可选参数中括号不需要写出来
*
* {% folding [color:yellow] [codeblock:false] [open:false] title %}
* {% folding [color:yellow] [child:codeblock] [open:false] title %}
* body
* {% endtable %}
*/
@ -10,11 +10,11 @@
'use strict';
hexo.extend.tag.register('folding', function(args, content) {
args = hexo.args.map(args, ['color', 'codeblock', 'open'], ['title']);
args = hexo.args.map(args, ['color', 'child', 'open'], ['title']);
var el = '';
// header
el += '<details class="tag-plugin folding"'
el += ' ' + hexo.args.joinTags(args, ['color', 'codeblock']).join(' ');
el += '<details class="tag-plugin folding"';
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
if (args.open && args.open == 'true') {
el += ' open';
}

View File

@ -6,7 +6,7 @@
* {% note [color:color] [title] content %}
*
* noteblock:
* {% noteblock [color:color] [codeblock:bool] title %}
* {% noteblock [color:color] [child:codeblock/tabs] title %}
* markdown content
* {% endnoteblock %}
*/
@ -23,12 +23,7 @@ function outputNoteBlock(args, content) {
}
// header
el += '<div class="tag-plugin note"';
if (color && color.length > 0) {
el += ' color="' + color + '"';
}
if (args.codeblock !== undefined) {
el += ' codeblock="' + args.codeblock + '"';
}
el += ' ' + hexo.args.joinTags(args, ['color', 'child']).join(' ');
el += '>';
// title
if (title && title.length > 0) {
@ -52,6 +47,6 @@ hexo.extend.tag.register('note', function(args) {
});
hexo.extend.tag.register('noteblock', function(args, content) {
args = hexo.args.map(args, ['color', 'codeblock'], ['title']);
args = hexo.args.map(args, ['color', 'child'], ['title']);
return outputNoteBlock(args, content);
}, {ends: true});

View File

@ -55,7 +55,7 @@ details[open]
>:last-child
margin-bottom: 0
details[codeblock]>div.body
details[child=codeblock]>div.body
padding: 0
background: transparent
.highlight

View File

@ -25,7 +25,7 @@
.md .tag-plugin.note:not([color])
.highlight
background: var(--block-hover)
.md .tag-plugin.note[codeblock=true]
.md .tag-plugin.note[child=codeblock]
padding: 0
>.title, >.body:only-child
margin-top: 0
@ -35,3 +35,9 @@
margin: 0
border: none
background: none
.md .tag-plugin.note[child=tabs]
>.body
margin: 0
>.tabs
margin-top: .5rem