diff --git a/scripts/tags/index.js b/scripts/tags/index.js index f714280..658461a 100644 --- a/scripts/tags/index.js +++ b/scripts/tags/index.js @@ -39,4 +39,6 @@ hexo.extend.tag.register('poetry', require('./lib/poetry')(hexo), true) hexo.extend.tag.register('quot', require('./lib/quot')(hexo)) 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)) // others diff --git a/scripts/tags/lib/audio.js b/scripts/tags/lib/audio.js new file mode 100644 index 0000000..69db86c --- /dev/null +++ b/scripts/tags/lib/audio.js @@ -0,0 +1,23 @@ +/** + * audio.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/ + * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) + * + * {% audio src %} + * + */ + +'use strict'; + +module.exports = ctx => function(args) { + args = ctx.args.map(args, ['type'], ['src']) + if (args.type == null) { + args.type = 'audio/mp3' + } + return ` +
+ +
+ ` +} \ No newline at end of file diff --git a/scripts/tags/lib/md.js b/scripts/tags/lib/md.js index c50863a..b30b056 100644 --- a/scripts/tags/lib/md.js +++ b/scripts/tags/lib/md.js @@ -4,7 +4,7 @@ * * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) * - * {% md [src:url] %} + * {% md src %} * */ 'use strict' diff --git a/scripts/tags/lib/video.js b/scripts/tags/lib/video.js new file mode 100644 index 0000000..046567b --- /dev/null +++ b/scripts/tags/lib/video.js @@ -0,0 +1,23 @@ +/** + * video.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/ + * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) + * + * {% video src %} + * + */ + +'use strict'; + +module.exports = ctx => function(args) { + args = ctx.args.map(args, ['type'], ['src']) + if (args.type == null) { + args.type = 'video/mp4' + } + return ` +
+ +
+ ` +} diff --git a/source/css/_common/media.styl b/source/css/_common/media.styl new file mode 100644 index 0000000..6e98899 --- /dev/null +++ b/source/css/_common/media.styl @@ -0,0 +1,9 @@ +audio,video + border-radius: $border-block + max-width: 100% +video + z-index: 1 + box-shadow: $boxshadow-card-float +.video + line-height: 0 + text-align: center \ No newline at end of file