From 05564d4bbc30f685257e6729aa02bbbf40b6ea5b Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Tue, 25 Oct 2022 22:41:56 +0800 Subject: [PATCH] linkcard --- _config.yml | 2 +- scripts/tags/link.js | 20 ++-- source/css/_common/base.styl | 2 +- source/css/_layout/tag-plugins/link.styl | 68 +++++++------ source/js/main.js | 22 +++-- source/js/plugins/linkcard.js | 118 +++++++++++++++++++++++ 6 files changed, 186 insertions(+), 46 deletions(-) create mode 100644 source/js/plugins/linkcard.js diff --git a/_config.yml b/_config.yml index 3bfb9e7..4618cf2 100755 --- a/_config.yml +++ b/_config.yml @@ -250,7 +250,7 @@ plugins: friends: /js/plugins/friends.js ghinfo: /js/plugins/ghinfo.js timeline: /js/plugins/timeline.js - + linkcard: /js/plugins/linkcard.js marked: https://cdn.bootcdn.net/ajax/libs/marked/4.0.18/marked.min.js diff --git a/scripts/tags/link.js b/scripts/tags/link.js index a6ce540..95498ac 100644 --- a/scripts/tags/link.js +++ b/scripts/tags/link.js @@ -2,7 +2,7 @@ * link.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) * - * {% link url title [description] [icon:src] %} + * {% link url [title] [desc:true/false] [icon:src] %} */ 'use strict'; @@ -11,11 +11,11 @@ var util = require('hexo-util'); const full_url_for = require('hexo-util').full_url_for.bind(hexo); hexo.extend.tag.register('link', function(args) { - args = hexo.args.map(args, ['icon'], ['url', 'title', 'description']); + args = hexo.args.map(args, ['icon', 'desc'], ['url', 'title']); var el = ''; el += '