From 41beaa718b1d37e5eb4ca128b98dc0b385678caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E7=BB=A7=E9=B9=8F?= Date: Fri, 6 Apr 2018 20:59:38 +0800 Subject: [PATCH] support for custom cap name in options --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 840773d..023f7f8 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ function str2obj(s){ function get_result(data, url, raw_url, start, stop, options, codeTag){ var split_data = data.split(/\r\n|\r|\n/).slice(start - 1, stop).join('\n') var ext = path.extname(raw_url).slice(1) - var basename = path.basename(raw_url) + var basename = options['name'] || path.basename(raw_url) var arg if(options['cap']){ arg = [basename, 'lang:' + ext, url] @@ -113,4 +113,4 @@ function ghcode(args){ }) } -hexo.extend.tag.register('ghcode', ghcode, {async: true}) \ No newline at end of file +hexo.extend.tag.register('ghcode', ghcode, {async: true})