From 19187065a49f27afa06eafb86155fb9d639d3d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=94=E5=90=AC=E9=A3=8E=E5=90=9F?= <93642775+HcGys@users.noreply.github.com> Date: Fri, 10 May 2024 09:56:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=98=85=E8=AF=BB=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=20(#462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 添加阅读标签 * 修改阅读标签语法格式 * 修改阅读标签语法注释说明 --- scripts/tags/index.js | 5 + scripts/tags/lib/read/paper.js | 90 +++++++++++++++ scripts/tags/lib/read/reel.js | 43 ++++++++ source/css/_components/tag-plugins/index.styl | 1 + .../_components/tag-plugins/read/paper.styl | 98 +++++++++++++++++ .../_components/tag-plugins/read/reel.styl | 103 ++++++++++++++++++ 6 files changed, 340 insertions(+) create mode 100644 scripts/tags/lib/read/paper.js create mode 100644 scripts/tags/lib/read/reel.js create mode 100644 source/css/_components/tag-plugins/index.styl create mode 100644 source/css/_components/tag-plugins/read/paper.styl create mode 100644 source/css/_components/tag-plugins/read/reel.styl diff --git a/scripts/tags/index.js b/scripts/tags/index.js index d6ca370..f687b4c 100644 --- a/scripts/tags/index.js +++ b/scripts/tags/index.js @@ -43,4 +43,9 @@ hexo.extend.tag.register('hashtag', require('./lib/hashtag')(hexo)) hexo.extend.tag.register('okr', require('./lib/okr')(hexo), {ends: true}) hexo.extend.tag.register('audio', require('./lib/audio')(hexo)) hexo.extend.tag.register('video', require('./lib/video')(hexo)) + +// read 阅读类 +hexo.extend.tag.register('reel', require('./lib/read/reel')(hexo), true) +hexo.extend.tag.register('paper', require('./lib/read/paper')(hexo), true) + // others diff --git a/scripts/tags/lib/read/paper.js b/scripts/tags/lib/read/paper.js new file mode 100644 index 0000000..9fbf079 --- /dev/null +++ b/scripts/tags/lib/read/paper.js @@ -0,0 +1,90 @@ +/** + * paper.js v1.1 | https://github.com/HcGys/stellar/ + * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) + * + * paper: + * {% paper [style:underline|无] [title:标题] [author:作者] [date:日期] [footer:footer] %} + * + * + * section-content + * + * + * paragraph-content + * + * + * line-content + * + * {% endpaper %} + * + */ + +'use strict' + +module.exports = ctx => function(args, content) { + var el = '' + args = ctx.args.map(args, ['style','title', 'author', 'date', 'footer']) + + el += '