From f37326822c2d83a3522ce581440ebc00245a74c8 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 14 Jul 2021 00:03:28 +0800 Subject: [PATCH] child tag --- scripts/tags/folding.js | 8 ++++---- scripts/tags/note.js | 11 +++-------- source/css/_layout/tag-plugins/folding.styl | 2 +- source/css/_layout/tag-plugins/note.styl | 8 +++++++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/tags/folding.js b/scripts/tags/folding.js index c1119e4..61bda9d 100644 --- a/scripts/tags/folding.js +++ b/scripts/tags/folding.js @@ -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 += '
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}); diff --git a/source/css/_layout/tag-plugins/folding.styl b/source/css/_layout/tag-plugins/folding.styl index 5b54937..22fc9e8 100644 --- a/source/css/_layout/tag-plugins/folding.styl +++ b/source/css/_layout/tag-plugins/folding.styl @@ -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 diff --git a/source/css/_layout/tag-plugins/note.styl b/source/css/_layout/tag-plugins/note.styl index e996742..7dffac9 100644 --- a/source/css/_layout/tag-plugins/note.styl +++ b/source/css/_layout/tag-plugins/note.styl @@ -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